aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_account.py')
-rw-r--r--tests/test_account.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/tests/test_account.py b/tests/test_account.py
new file mode 100644
index 0000000..dac65ac
--- /dev/null
+++ b/tests/test_account.py
@@ -0,0 +1,96 @@
1import pytest
2from mastodon.Mastodon import MastodonAPIError
3
4@pytest.mark.vcr()
5def test_account(api):
6 account = api.account(1)
7 assert account
8
9
10@pytest.mark.vcr()
11def test_account_following(api):
12 following = api.account_following(1)
13 assert isinstance(following, list)
14
15
16@pytest.mark.vcr()
17def test_account_followers(api):
18 followers = api.account_followers(1)
19 assert isinstance(followers, list)
20
21
22@pytest.mark.vcr()
23def test_account_relationships(api):
24 relationships = api.account_relationships(1)
25 assert isinstance(relationships, list)
26 assert len(relationships) == 1
27
28
29@pytest.mark.vcr()
30def test_account_search(api):
31 results = api.account_search('admin')
32 assert isinstance(results, list)
33
34
35@pytest.mark.vcr()
36def test_account_follow_unfollow(api):
37 relationship = api.account_follow(1)
38 try:
39 assert relationship
40 assert relationship['following']
41 finally:
42 relationship = api.account_unfollow(1)
43 assert relationship
44 assert not relationship['following']
45
46
47@pytest.mark.vcr()
48def test_account_block_unblock(api):
49 relationship = api.account_block(1)
50 try:
51 assert relationship
52 assert relationship['blocking']
53 finally:
54 relationship = api.account_unblock(1)
55 assert relationship
56 assert not relationship['blocking']
57
58
59@pytest.mark.vcr()
60def test_account_mute_unmute(api):
61 relationship = api.account_mute(1)
62 try:
63 assert relationship
64 assert relationship['muting']
65 finally:
66 relationship = api.account_unmute(1)
67 assert relationship
68 assert not relationship['muting']
69
70
71@pytest.mark.vcr()
72def test_mutes(api):
73 mutes = api.mutes()
74 assert isinstance(mutes, list)
75
76
77@pytest.mark.vcr()
78def test_blocks(api):
79 blocks = api.blocks()
80 assert isinstance(blocks, list)
81
82
83@pytest.mark.vcr()
84def test_account_update_credentials(api):
85 import base64
86 with open('tests/image.jpg', 'rb') as f:
87 image = f.read()
88 b64_image = base64.b64encode(image)
89 data_uri = b'data:image/jpeg;base64,' + b64_image
90
91 account = api.account_update_credentials(
92 display_name='John Lennon',
93 note='I walk funny',
94 avatar = data_uri,
95 header = data_uri)
96 assert account
Powered by cgit v1.2.3 (git 2.41.0)