aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-27 02:25:33 +0100
committercodl <[email protected]>2017-11-27 03:12:02 +0100
commit4b60a0d3cfba50319d2a8a47458db9a89a1a4f12 (patch)
tree0d61d4e79ed28567b8ab63b12d98aaa463927b0f /tests/test_hooks.py
parent430bebc12481c1ad44592f03ad7d8acbed370eab (diff)
downloadmastodon.py-4b60a0d3cfba50319d2a8a47458db9a89a1a4f12.tar.gz
add tests for json hooks
including a failing test for that thing i fixed earlier which isn't in this branch 😓
Diffstat (limited to 'tests/test_hooks.py')
-rw-r--r--tests/test_hooks.py28
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 @@
1from .fixtures import *
2from datetime import datetime
3
4@pytest.mark.vcr()
5def test_id_hook(status):
6 assert isinstance(status['id'], int)
7
8@pytest.mark.vcr()
9def 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()
18def 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()
27def test_date_hook(status):
28 assert isinstance(status['created_at'], datetime)
Powered by cgit v1.2.3 (git 2.41.0)