diff options
author | Lorenz Diener <[email protected]> | 2017-11-29 17:48:56 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-11-29 17:48:56 +0100 |
commit | 961425e2abc91d693004f2c0d073e387de64e58c (patch) | |
tree | 8b1512daf97ab63b54f4edebc83b35f524571c53 /tests/test_hooks.py | |
parent | 5b811b719d379be06ed256da2ee806a051461795 (diff) | |
parent | e79987df2410ee32302abed9e486a72b2dfc9707 (diff) | |
download | mastodon.py-961425e2abc91d693004f2c0d073e387de64e58c.tar.gz |
Merge pull request #109 from codl/test-suite
Test suite
Diffstat (limited to 'tests/test_hooks.py')
-rw-r--r-- | tests/test_hooks.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_hooks.py b/tests/test_hooks.py new file mode 100644 index 0000000..905672d --- /dev/null +++ b/tests/test_hooks.py | |||
@@ -0,0 +1,32 @@ | |||
1 | import pytest | ||
2 | from datetime import datetime | ||
3 | |||
4 | |||
5 | @pytest.mark.vcr() | ||
6 | def test_id_hook(status): | ||
7 | assert isinstance(status['id'], int) | ||
8 | |||
9 | |||
10 | @pytest.mark.xfail(reason='fixed in upstream') | ||
11 | @pytest.mark.vcr() | ||
12 | def test_id_hook_in_reply_to(api, status): | ||
13 | reply = api.status_post('Reply!', in_reply_to_id=status['id']) | ||
14 | try: | ||
15 | assert isinstance(reply['in_reply_to_id'], int) | ||
16 | assert isinstance(reply['in_reply_to_account_id'], int) | ||
17 | finally: | ||
18 | api.status_delete(reply['id']) | ||
19 | |||
20 | |||
21 | @pytest.mark.vcr() | ||
22 | def test_id_hook_within_reblog(api, status): | ||
23 | reblog = api.status_reblog(status['id']) | ||
24 | try: | ||
25 | assert isinstance(reblog['reblog']['id'], int) | ||
26 | finally: | ||
27 | api.status_delete(reblog['id']) | ||
28 | |||
29 | |||
30 | @pytest.mark.vcr() | ||
31 | def test_date_hook(status): | ||
32 | assert isinstance(status['created_at'], datetime) | ||