aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-25 00:09:54 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-25 00:09:54 +0200
commit89678e05656c149e2e79d8ab09721059724fa8a0 (patch)
treed267c6331d5416c69379b779922852861262308d
parentcbfb3977ebc54d195924aa2e3ab27865fa9138a1 (diff)
downloadmastodon.py-89678e05656c149e2e79d8ab09721059724fa8a0.tar.gz
Fix tests
-rw-r--r--mastodon/Mastodon.py7
-rw-r--r--tests/test_constructor.py6
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:
3647 else: 3647 else:
3648 json_object[k] = dateutil.parser.parse(v) 3648 json_object[k] = dateutil.parser.parse(v)
3649 except: 3649 except:
3650 if isinstance(v, str) and len(v.strip()) == 0: 3650 # When we can't parse a date, we just leave the field out
3651 # Pleroma bug workaround: Empty string becomes start of epoch 3651 del json_object[k]
3652 json_object[k] = datetime.datetime.fromtimestamp(0)
3653 else:
3654 raise MastodonAPIError('Encountered invalid date.')
3655 return json_object 3652 return json_object
3656 3653
3657 @staticmethod 3654 @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):
8 access = tmpdir.join('access') 8 access = tmpdir.join('access')
9 access.write_text(u'baz\n', 'UTF-8') 9 access.write_text(u'baz\n', 'UTF-8')
10 api = Mastodon( 10 api = Mastodon(
11 str(client), 11 str(client),
12 access_token=str(access)) 12 access_token=str(access),
13 api_base_url="mastodon.social"
14 )
13 assert api.client_id == 'foo' 15 assert api.client_id == 'foo'
14 assert api.client_secret == 'bar' 16 assert api.client_secret == 'bar'
15 assert api.access_token == 'baz' 17 assert api.access_token == 'baz'
Powered by cgit v1.2.3 (git 2.41.0)