From f920f8b58429b5d7dea43442765df824ac04bf91 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sat, 22 Jun 2019 22:48:30 +0200 Subject: Add final round of tests for moderation API --- tests/test_admin.py | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'tests/test_admin.py') 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): api2.admin_account_unsuspend(account) api2.admin_account_enable(account) api2.admin_account_unsilence(account) - + +@pytest.mark.vcr() +def test_admin_reports(api, api2, status): + account = api.account_verify_credentials() + account2 = api2.account_verify_credentials() + report = api2.report(account, status, "api crimes") + assert(report) + assert(not report.action_taken) + + report_list = api2.admin_reports() + assert(report.id in [x.id for x in report_list]) + + report = api2.admin_report_resolve(report) + report_list = api2.admin_reports() + assert(report.action_taken) + assert(report.action_taken_by_account.id == account2.id) + assert(not report.id in [x.id for x in report_list]) + + report = api2.admin_report_reopen(report) + report_list = api2.admin_reports() + assert(not report.action_taken) + assert(report.id in [x.id for x in report_list]) + + report = api2.admin_report_assign(report) + assert(report.assigned_account.id == account2.id) + + report = api2.admin_report_unassign(report) + assert(report.assigned_account is None) + + report2 = api2.admin_report(report) + assert(report2) + assert(report2.id == report.id) + +@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.") +def test_admin_accountrequests(api2): + pass + -- cgit v1.2.3