aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_push.py')
-rw-r--r--tests/test_push.py48
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/test_push.py b/tests/test_push.py
index 5313a3c..2ad215e 100644
--- a/tests/test_push.py
+++ b/tests/test_push.py
@@ -1,4 +1,6 @@
1import pytest 1import pytest
2import time
3from mastodon.Mastodon import MastodonNotFoundError
2 4
3def test_decrypt(api): 5def test_decrypt(api):
4 priv = { 6 priv = {
@@ -20,4 +22,48 @@ def test_decrypt(api):
20 22
21 assert decrypted 23 assert decrypted
22 assert decrypted.title == 'You were mentioned by fake halcy' 24 assert decrypted.title == 'You were mentioned by fake halcy'
23 \ No newline at end of file 25
26@pytest.mark.vcr(match_on=['path'])
27def test_push_set(api):
28 priv, pub = api.push_subscription_generate_keys()
29 sub = api.push_subscription_set("example.com", pub)
30
31 assert sub == api.push_subscription()
32 assert sub.endpoint == "https://example.com"
33
34@pytest.mark.vcr(match_on=['path'])
35def test_push_update(api):
36 priv, pub = api.push_subscription_generate_keys()
37 sub = api.push_subscription_set("example.com", pub,follow_events=False,
38 favourite_events=False, reblog_events=False,
39 mention_events=False)
40
41 sub2 = api.push_subscription_update(follow_events=True, favourite_events=True,
42 reblog_events=True, mention_events=True)
43 time.sleep(1)
44 assert sub2 == api.push_subscription()
45
46 sub3 = api.push_subscription_update(follow_events=False, favourite_events=False,
47 reblog_events=False, mention_events=False)
48 time.sleep(1)
49 assert sub3 == api.push_subscription()
50
51 assert sub3.alerts.follow == False
52 assert sub3.alerts.favourite == False
53 assert sub3.alerts.reblog == False
54 assert sub3.alerts.mention == False
55 assert sub2.alerts.follow == True
56 assert sub2.alerts.favourite == True
57 assert sub2.alerts.reblog == True
58 assert sub2.alerts.mention == True
59
60
61@pytest.mark.vcr(match_on=['path'])
62def test_push_delete(api):
63 priv, pub = api.push_subscription_generate_keys()
64 sub = api.push_subscription_set("example.com", pub)
65 assert sub
66
67 api.push_subscription_delete()
68 with pytest.raises(MastodonNotFoundError):
69 api.push_subscription() \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)