diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-17 22:00:37 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-17 22:00:37 +0200 |
commit | 725f79466de65743df0c3498a1bb08e106b5209e (patch) | |
tree | 556b797c38768bef5039f58713536f7072afaf40 /tests/test_timeline.py | |
parent | ec0194c643d1a59cae8a6c8137f382db8fb4e0aa (diff) | |
download | mastodon.py-725f79466de65743df0c3498a1bb08e106b5209e.tar.gz |
Fix tests
Diffstat (limited to 'tests/test_timeline.py')
-rw-r--r-- | tests/test_timeline.py | 12 |
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 | |||
2 | import time | 2 | import time |
3 | from mastodon.Mastodon import MastodonAPIError, MastodonIllegalArgumentError, MastodonUnauthorizedError | 3 | from mastodon.Mastodon import MastodonAPIError, MastodonIllegalArgumentError, MastodonUnauthorizedError |
4 | import datetime | 4 | import datetime |
5 | import pickle | ||
6 | import os | ||
5 | 7 | ||
6 | @pytest.mark.vcr() | 8 | @pytest.mark.vcr() |
7 | def test_public_tl_anonymous(api_anonymous, status3): | 9 | def 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() |
80 | def test_min_max_id_datetimes(api, status): | 82 | def 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) |