kopia lustrzana https://github.com/halcy/Mastodon.py
Fix tests
rodzic
cbfb3977eb
commit
89678e0565
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Ładowanie…
Reference in New Issue