diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-13 15:33:10 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-13 15:33:10 +0200 |
commit | b1e1ec7bdc9e84ecd31626f1a4fbf645e84d0bb2 (patch) | |
tree | 3ecf530456b311057658b3b2e749ad017074455b /tests/test_account.py | |
parent | a17b20cfa142469019cd5982ba200510afc1f884 (diff) | |
download | mastodon.py-b1e1ec7bdc9e84ecd31626f1a4fbf645e84d0bb2.tar.gz |
Add support for timed mutes, fix tests to actually pass with new setup
Diffstat (limited to 'tests/test_account.py')
-rw-r--r-- | tests/test_account.py | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/test_account.py b/tests/test_account.py index 231f85c..dad17e8 100644 --- a/tests/test_account.py +++ b/tests/test_account.py | |||
@@ -5,7 +5,7 @@ import time | |||
5 | 5 | ||
6 | @pytest.mark.vcr() | 6 | @pytest.mark.vcr() |
7 | def test_account(api): | 7 | def test_account(api): |
8 | account = api.account(1234567890123456) | 8 | account = api.account(api.account_verify_credentials()) |
9 | assert account | 9 | assert account |
10 | 10 | ||
11 | @pytest.mark.vcr() | 11 | @pytest.mark.vcr() |
@@ -17,19 +17,19 @@ def test_verify_credentials(api): | |||
17 | 17 | ||
18 | @pytest.mark.vcr() | 18 | @pytest.mark.vcr() |
19 | def test_account_following(api): | 19 | def test_account_following(api): |
20 | following = api.account_following(1234567890123456) | 20 | following = api.account_following(api.account_verify_credentials()) |
21 | assert isinstance(following, list) | 21 | assert isinstance(following, list) |
22 | 22 | ||
23 | 23 | ||
24 | @pytest.mark.vcr() | 24 | @pytest.mark.vcr() |
25 | def test_account_followers(api): | 25 | def test_account_followers(api): |
26 | followers = api.account_followers(1234567890123456) | 26 | followers = api.account_followers(api.account_verify_credentials()) |
27 | assert isinstance(followers, list) | 27 | assert isinstance(followers, list) |
28 | 28 | ||
29 | 29 | ||
30 | @pytest.mark.vcr() | 30 | @pytest.mark.vcr() |
31 | def test_account_relationships(api): | 31 | def test_account_relationships(api): |
32 | relationships = api.account_relationships(1234567890123456) | 32 | relationships = api.account_relationships(api.account_verify_credentials()) |
33 | assert isinstance(relationships, list) | 33 | assert isinstance(relationships, list) |
34 | assert len(relationships) == 1 | 34 | assert len(relationships) == 1 |
35 | 35 | ||
@@ -57,41 +57,47 @@ def test_account_search(api): | |||
57 | assert len(results) == 2 | 57 | assert len(results) == 2 |
58 | 58 | ||
59 | @pytest.mark.vcr() | 59 | @pytest.mark.vcr() |
60 | def test_account_follow_unfollow(api): | 60 | def test_account_follow_unfollow(api, api2): |
61 | relationship = api.account_follow(1234567890123457) | 61 | api2_id = api2.account_verify_credentials().id |
62 | relationship = api.account_follow(api2_id) | ||
62 | try: | 63 | try: |
63 | assert relationship | 64 | assert relationship |
64 | print(relationship) | 65 | print(relationship) |
65 | assert relationship['following'] | 66 | assert relationship['following'] |
66 | finally: | 67 | finally: |
67 | relationship = api.account_unfollow(1234567890123457) | 68 | relationship = api.account_unfollow(api2_id) |
68 | assert relationship | 69 | assert relationship |
69 | assert not relationship['following'] | 70 | assert not relationship['following'] |
70 | 71 | ||
71 | 72 | ||
72 | @pytest.mark.vcr() | 73 | @pytest.mark.vcr() |
73 | def test_account_block_unblock(api): | 74 | def test_account_block_unblock(api, api2): |
74 | relationship = api.account_block(1234567890123457) | 75 | api2_id = api2.account_verify_credentials().id |
76 | relationship = api.account_block(api2_id) | ||
75 | try: | 77 | try: |
76 | assert relationship | 78 | assert relationship |
77 | assert relationship['blocking'] | 79 | assert relationship['blocking'] |
78 | finally: | 80 | finally: |
79 | relationship = api.account_unblock(1234567890123457) | 81 | relationship = api.account_unblock(api2_id) |
80 | assert relationship | 82 | assert relationship |
81 | assert not relationship['blocking'] | 83 | assert not relationship['blocking'] |
82 | 84 | ||
83 | 85 | ||
84 | @pytest.mark.vcr() | 86 | @pytest.mark.vcr() |
85 | def test_account_mute_unmute(api): | 87 | def test_account_mute_unmute(api, api2): |
86 | relationship = api.account_mute(1234567890123457) | 88 | api2_id = api2.account_verify_credentials().id |
89 | relationship = api.account_mute(api2_id) | ||
87 | try: | 90 | try: |
88 | assert relationship | 91 | assert relationship |
89 | assert relationship['muting'] | 92 | assert relationship['muting'] |
90 | finally: | 93 | finally: |
91 | relationship = api.account_unmute(1234567890123457) | 94 | relationship = api.account_unmute(api2_id) |
92 | assert relationship | 95 | assert relationship |
93 | assert not relationship['muting'] | 96 | assert not relationship['muting'] |
94 | 97 | ||
98 | relationship = api.account_mute(api2_id, duration = 3) | ||
99 | time.sleep(8) | ||
100 | assert not api.account_relationships(api2_id)[0].muting | ||
95 | 101 | ||
96 | @pytest.mark.vcr() | 102 | @pytest.mark.vcr() |
97 | def test_mutes(api): | 103 | def test_mutes(api): |