diff options
author | Lorenz Diener <[email protected]> | 2019-06-22 22:32:21 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-06-22 22:32:21 +0200 |
commit | add974ae2985a8af72a0e2e4182e2eccec8d309c (patch) | |
tree | f54612a314e13ee313d1181857b79e351c103a78 /tests/test_admin.py | |
parent | a34e21cfa7cd71fbfc70b4836505e6399e0ff672 (diff) | |
download | mastodon.py-add974ae2985a8af72a0e2e4182e2eccec8d309c.tar.gz |
Add first half of tests for moderation API
Diffstat (limited to 'tests/test_admin.py')
-rw-r--r-- | tests/test_admin.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/test_admin.py b/tests/test_admin.py new file mode 100644 index 0000000..57e9fb2 --- /dev/null +++ b/tests/test_admin.py | |||
@@ -0,0 +1,46 @@ | |||
1 | import pytest | ||
2 | |||
3 | @pytest.mark.vcr() | ||
4 | def test_admin_accounts(api2): | ||
5 | accounts = api2.admin_accounts() | ||
6 | |||
7 | assert accounts | ||
8 | assert len(accounts) > 0 | ||
9 | |||
10 | account_self = api2.account_verify_credentials() | ||
11 | account_admin = api2.admin_account(account_self) | ||
12 | |||
13 | assert(account_admin) | ||
14 | assert(account_admin.id == account_self.id) | ||
15 | |||
16 | @pytest.mark.vcr() | ||
17 | def test_admin_moderation(api, api2): | ||
18 | account_initial = api.account_verify_credentials() | ||
19 | account = account_initial | ||
20 | |||
21 | try: | ||
22 | api2.admin_account_moderate(account, "disable") | ||
23 | account = api2.admin_account(account_initial) | ||
24 | assert(account.disabled) | ||
25 | |||
26 | account = api2.admin_account_enable(account) | ||
27 | assert(not account.disabled) | ||
28 | |||
29 | api2.admin_account_moderate(account, "silence") | ||
30 | account = api2.admin_account(account_initial) | ||
31 | assert(account.silenced) | ||
32 | |||
33 | account = api2.admin_account_unsilence(account) | ||
34 | assert(not account.silenced) | ||
35 | |||
36 | api2.admin_account_moderate(account, "suspend") | ||
37 | account = api2.admin_account(account_initial) | ||
38 | assert(account.suspended) | ||
39 | |||
40 | account = api2.admin_account_unsuspend(account) | ||
41 | assert(not account.suspended) | ||
42 | finally: | ||
43 | api2.admin_account_unsuspend(account) | ||
44 | api2.admin_account_enable(account) | ||
45 | api2.admin_account_unsilence(account) | ||
46 | |||