diff options
author | Lorenz Diener <[email protected]> | 2019-06-22 22:48:30 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-06-22 22:48:30 +0200 |
commit | f920f8b58429b5d7dea43442765df824ac04bf91 (patch) | |
tree | 3e74d678329a290156889d8e2d48a384381c1deb /tests/test_admin.py | |
parent | add974ae2985a8af72a0e2e4182e2eccec8d309c (diff) | |
download | mastodon.py-f920f8b58429b5d7dea43442765df824ac04bf91.tar.gz |
Add final round of tests for moderation API
Diffstat (limited to 'tests/test_admin.py')
-rw-r--r-- | tests/test_admin.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/test_admin.py b/tests/test_admin.py index 57e9fb2..4138783 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py | |||
@@ -43,4 +43,40 @@ def test_admin_moderation(api, api2): | |||
43 | api2.admin_account_unsuspend(account) | 43 | api2.admin_account_unsuspend(account) |
44 | api2.admin_account_enable(account) | 44 | api2.admin_account_enable(account) |
45 | api2.admin_account_unsilence(account) | 45 | api2.admin_account_unsilence(account) |
46 | 46 | ||
47 | @pytest.mark.vcr() | ||
48 | def test_admin_reports(api, api2, status): | ||
49 | account = api.account_verify_credentials() | ||
50 | account2 = api2.account_verify_credentials() | ||
51 | report = api2.report(account, status, "api crimes") | ||
52 | assert(report) | ||
53 | assert(not report.action_taken) | ||
54 | |||
55 | report_list = api2.admin_reports() | ||
56 | assert(report.id in [x.id for x in report_list]) | ||
57 | |||
58 | report = api2.admin_report_resolve(report) | ||
59 | report_list = api2.admin_reports() | ||
60 | assert(report.action_taken) | ||
61 | assert(report.action_taken_by_account.id == account2.id) | ||
62 | assert(not report.id in [x.id for x in report_list]) | ||
63 | |||
64 | report = api2.admin_report_reopen(report) | ||
65 | report_list = api2.admin_reports() | ||
66 | assert(not report.action_taken) | ||
67 | assert(report.id in [x.id for x in report_list]) | ||
68 | |||
69 | report = api2.admin_report_assign(report) | ||
70 | assert(report.assigned_account.id == account2.id) | ||
71 | |||
72 | report = api2.admin_report_unassign(report) | ||
73 | assert(report.assigned_account is None) | ||
74 | |||
75 | report2 = api2.admin_report(report) | ||
76 | assert(report2) | ||
77 | assert(report2.id == report.id) | ||
78 | |||
79 | @pytest.mark.skip(reason="reject / accept of account requests isn't really testable without modifying instance settings. anyone want to fumble those into the DB setup and write this test, please do.") | ||
80 | def test_admin_accountrequests(api2): | ||
81 | pass | ||
82 | |||