aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-17 22:00:37 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-17 22:00:37 +0200
commit725f79466de65743df0c3498a1bb08e106b5209e (patch)
tree556b797c38768bef5039f58713536f7072afaf40 /tests/test_timeline.py
parentec0194c643d1a59cae8a6c8137f382db8fb4e0aa (diff)
downloadmastodon.py-725f79466de65743df0c3498a1bb08e106b5209e.tar.gz
Fix tests
Diffstat (limited to 'tests/test_timeline.py')
-rw-r--r--tests/test_timeline.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test_timeline.py b/tests/test_timeline.py
index fbeae8e..9d63025 100644
--- a/tests/test_timeline.py
+++ b/tests/test_timeline.py
@@ -2,6 +2,8 @@ import pytest
2import time 2import time
3from mastodon.Mastodon import MastodonAPIError, MastodonIllegalArgumentError, MastodonUnauthorizedError 3from mastodon.Mastodon import MastodonAPIError, MastodonIllegalArgumentError, MastodonUnauthorizedError
4import datetime 4import datetime
5import pickle
6import os
5 7
6@pytest.mark.vcr() 8@pytest.mark.vcr()
7def test_public_tl_anonymous(api_anonymous, status3): 9def test_public_tl_anonymous(api_anonymous, status3):
@@ -78,9 +80,13 @@ def test_min_max_id(api, status):
78 80
79@pytest.mark.vcr() 81@pytest.mark.vcr()
80def test_min_max_id_datetimes(api, status): 82def test_min_max_id_datetimes(api, status):
81 the_past = datetime.datetime.now() - datetime.timedelta(seconds=20) 83 if os.path.exists("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl"):
82 the_future = datetime.datetime.now() + datetime.timedelta(seconds=20) 84 the_past, the_future, the_far_future = pickle.load(open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'rb'))
83 the_far_future = datetime.datetime.now() + datetime.timedelta(seconds=40) 85 else:
86 the_past = datetime.datetime.now() - datetime.timedelta(seconds=20)
87 the_future = datetime.datetime.now() + datetime.timedelta(seconds=20)
88 the_far_future = datetime.datetime.now() + datetime.timedelta(seconds=40)
89 pickle.dump((the_past, the_future, the_far_future), open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'wb'))
84 90
85 time.sleep(3) 91 time.sleep(3)
86 tl = api.timeline_home(min_id = the_past, max_id = the_future) 92 tl = api.timeline_home(min_id = the_past, max_id = the_future)
Powered by cgit v1.2.3 (git 2.41.0)