From 89678e05656c149e2e79d8ab09721059724fa8a0 Mon Sep 17 00:00:00 2001 From: halcy Date: Fri, 25 Nov 2022 00:09:54 +0200 Subject: Fix tests --- mastodon/Mastodon.py | 7 ++----- tests/test_constructor.py | 6 ++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index d0b3606..6a783b4 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -3647,11 +3647,8 @@ class Mastodon: else: json_object[k] = dateutil.parser.parse(v) except: - if isinstance(v, str) and len(v.strip()) == 0: - # Pleroma bug workaround: Empty string becomes start of epoch - json_object[k] = datetime.datetime.fromtimestamp(0) - else: - raise MastodonAPIError('Encountered invalid date.') + # When we can't parse a date, we just leave the field out + del json_object[k] return json_object @staticmethod diff --git a/tests/test_constructor.py b/tests/test_constructor.py index d997a5d..ed38b9c 100644 --- a/tests/test_constructor.py +++ b/tests/test_constructor.py @@ -8,8 +8,10 @@ def test_constructor_from_filenames(tmpdir): access = tmpdir.join('access') access.write_text(u'baz\n', 'UTF-8') api = Mastodon( - str(client), - access_token=str(access)) + str(client), + access_token=str(access), + api_base_url="mastodon.social" + ) assert api.client_id == 'foo' assert api.client_secret == 'bar' assert api.access_token == 'baz' -- cgit v1.2.3