diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-24 01:53:34 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-24 01:53:34 +0200 |
commit | f81978a39c7ad2124951806cd66fcbadffc16d59 (patch) | |
tree | d55551512f179b15f8a96e114d537663a322b7a3 /tests/test_notifications.py | |
parent | 066d543109496c732f6c05bfbe3418d30b648f42 (diff) | |
download | mastodon.py-f81978a39c7ad2124951806cd66fcbadffc16d59.tar.gz |
Add notification tests
Diffstat (limited to 'tests/test_notifications.py')
-rw-r--r-- | tests/test_notifications.py | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/test_notifications.py b/tests/test_notifications.py index 858bad4..bdd559c 100644 --- a/tests/test_notifications.py +++ b/tests/test_notifications.py | |||
@@ -12,7 +12,46 @@ def mention(api2): | |||
12 | def test_notifications(api, mention): | 12 | def test_notifications(api, mention): |
13 | time.sleep(3) | 13 | time.sleep(3) |
14 | notifications = api.notifications() | 14 | notifications = api.notifications() |
15 | api.notifications(notifications[0]) | 15 | assert api.notifications(notifications[0]) |
16 | assert notifications[0].status.id == mention.id | ||
17 | |||
18 | @pytest.mark.vcr() | ||
19 | def test_notifications_mentions_only(api, mention): | ||
20 | time.sleep(3) | ||
21 | notifications = api.notifications(mentions_only=True) | ||
22 | assert api.notifications(notifications[0]) | ||
23 | assert notifications[0].status.id == mention.id | ||
24 | |||
25 | @pytest.mark.vcr() | ||
26 | def test_notifications_exclude_types(api, mention): | ||
27 | time.sleep(3) | ||
28 | notifications = api.notifications(exclude_types=["mention"]) | ||
29 | if len(notifications) > 0: | ||
30 | assert notifications[0].status.id == mention.id | ||
31 | |||
32 | @pytest.mark.vcr() | ||
33 | def test_notifications_types(api, mention): | ||
34 | time.sleep(3) | ||
35 | notifications = api.notifications(types=["follow_request"]) | ||
36 | if len(notifications) > 0: | ||
37 | assert notifications[0].status.id == mention.id | ||
38 | notifications = api.notifications(types=["follow", "mention"]) | ||
39 | assert api.notifications(notifications[0]) | ||
40 | assert notifications[0].status.id == mention.id | ||
41 | |||
42 | @pytest.mark.vcr() | ||
43 | def test_notifications_exclude_and_types(api, mention): | ||
44 | time.sleep(3) | ||
45 | notifications = api.notifications(exclude_types=["mention"], types=["mention"]) | ||
46 | if len(notifications) > 0: | ||
47 | assert notifications[0].status.id == mention.id | ||
48 | notifications = api.notifications(exclude_types=["mention"], types=["follow_request"]) | ||
49 | if len(notifications) > 0: | ||
50 | assert notifications[0].status.id == mention.id | ||
51 | notifications = api.notifications(exclude_types=["follow_request"], types=["mention"]) | ||
52 | assert notifications[0].status.id == mention.id | ||
53 | notifications = api.notifications(exclude_types=["follow_request"], types=["mention", "follow_request"]) | ||
54 | assert notifications[0].status.id == mention.id | ||
16 | 55 | ||
17 | @pytest.mark.vcr() | 56 | @pytest.mark.vcr() |
18 | def test_notifications_dismiss(api, mention): | 57 | def test_notifications_dismiss(api, mention): |