diff options
Diffstat (limited to 'tests/test_hooks.py')
-rw-r--r-- | tests/test_hooks.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_hooks.py b/tests/test_hooks.py new file mode 100644 index 0000000..fe242a6 --- /dev/null +++ b/tests/test_hooks.py | |||
@@ -0,0 +1,28 @@ | |||
1 | from .fixtures import * | ||
2 | from datetime import datetime | ||
3 | |||
4 | @pytest.mark.vcr() | ||
5 | def test_id_hook(status): | ||
6 | assert isinstance(status['id'], int) | ||
7 | |||
8 | @pytest.mark.vcr() | ||
9 | def test_id_hook_in_reply_to(mastodon, status): | ||
10 | reply = mastodon.status_post('Reply!', in_reply_to_id=status['id']) | ||
11 | try: | ||
12 | assert isinstance(reply['in_reply_to_id'], int) | ||
13 | assert isinstance(reply['in_reply_to_account_id'], int) | ||
14 | finally: | ||
15 | mastodon.status_delete(reply['id']) | ||
16 | |||
17 | @pytest.mark.vcr() | ||
18 | def test_id_hook_within_reblog(mastodon, status): | ||
19 | reblog = mastodon.status_reblog(status['id']) | ||
20 | try: | ||
21 | assert isinstance(reblog['reblog']['id'], int) | ||
22 | finally: | ||
23 | mastodon.status_delete(reblog['id']) | ||
24 | |||
25 | |||
26 | @pytest.mark.vcr() | ||
27 | def test_date_hook(status): | ||
28 | assert isinstance(status['created_at'], datetime) | ||