diff options
author | Lorenz Diener <[email protected]> | 2019-04-28 19:36:12 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-04-28 19:36:12 +0200 |
commit | 1cbf923494ef5e3457460534f386fd2bf5b648fc (patch) | |
tree | b548aa1b371f7e3d445e00d216b4285622c2e6d2 /tests/test_status.py | |
parent | d7f5b4d66d47baa12d9e986c39385618adef0e71 (diff) | |
download | mastodon.py-1cbf923494ef5e3457460534f386fd2bf5b648fc.tar.gz |
Add scheduled status test
Diffstat (limited to 'tests/test_status.py')
-rw-r--r-- | tests/test_status.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_status.py b/tests/test_status.py index ad861ea..c34db0d 100644 --- a/tests/test_status.py +++ b/tests/test_status.py | |||
@@ -1,5 +1,6 @@ | |||
1 | import pytest | 1 | import pytest |
2 | from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError | 2 | from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError |
3 | import datetime | ||
3 | 4 | ||
4 | @pytest.mark.vcr() | 5 | @pytest.mark.vcr() |
5 | def test_status(status, api): | 6 | def test_status(status, api): |
@@ -121,3 +122,25 @@ def test_status_pin_unpin(status, api): | |||
121 | 122 | ||
122 | status = api.status_unpin(status['id']) | 123 | status = api.status_unpin(status['id']) |
123 | assert not status['pinned'] | 124 | assert not status['pinned'] |
125 | |||
126 | @pytest.mark.vcr() | ||
127 | def test_scheduled_status(api): | ||
128 | the_future = datetime.datetime.now() + datetime.timedelta(minutes=20) | ||
129 | scheduled_toot = api.status_post("please ensure adequate headroom", scheduled_at=the_future) | ||
130 | assert scheduled_toot | ||
131 | |||
132 | the_immediate_future = datetime.datetime.now() + datetime.timedelta(minutes=10) | ||
133 | scheduled_toot_2 = api.scheduled_status_update(scheduled_toot, the_immediate_future) | ||
134 | assert scheduled_toot_2 | ||
135 | assert scheduled_toot_2.id == scheduled_toot.id | ||
136 | assert scheduled_toot_2.scheduled_at < scheduled_toot.scheduled_at | ||
137 | |||
138 | scheduled_toot_list = api.scheduled_statuses() | ||
139 | assert scheduled_toot_2.id in map(lambda x: x.id, scheduled_toot_list) | ||
140 | |||
141 | scheduled_toot_3 = api.scheduled_status(scheduled_toot.id) | ||
142 | assert scheduled_toot_2.id == scheduled_toot_3.id | ||
143 | |||
144 | api.scheduled_status_delete(scheduled_toot_2) | ||
145 | scheduled_toot_list_2 = api.scheduled_statuses() | ||
146 | assert not scheduled_toot_2.id in map(lambda x: x.id, scheduled_toot_list_2) | ||