@@ -27,7 +27,13 @@ def test_list_submissions(db: Session, client: TestClient, logged_in_user):
27
27
assert response .json ()["results" ][0 ]["id" ] == str (submission .id )
28
28
29
29
30
- def test_get_metadata_submissions_report (db : Session , client : TestClient , logged_in_user ):
30
+ def test_get_metadata_submissions_report_as_non_admin (db : Session , client : TestClient , logged_in_user ):
31
+ response = client .request (method = "GET" , url = "/api/metadata_submission/report" )
32
+ assert response .status_code == 403
33
+
34
+
35
+ def test_get_metadata_submissions_report_as_admin (db : Session , client : TestClient , logged_in_admin_user ):
36
+ logged_in_user = logged_in_admin_user # makes a concise alias (also allows for verbatim code snippet reuse)
31
37
submission = fakes .MetadataSubmissionFactory (
32
38
author = logged_in_user , author_orcid = logged_in_user .orcid
33
39
)
@@ -39,19 +45,11 @@ def test_get_metadata_submissions_report(db: Session, client: TestClient, logged
39
45
)
40
46
41
47
# TODO: Create additional submissions.
42
-
43
48
db .commit ()
44
49
45
50
# TODO: Check additional aspects of the HTTP response.
46
-
47
- # The server will return an HTTP 403 Response when the client isn't an admin.
48
- #
49
- # TODO: Find an example of where a test request is submitted as an admin, or even
50
- # as any logged-in user (I assume the endpoint would have returned a 401
51
- # if the user wasn't logged in at all).
52
- #
53
51
response = client .request (method = "GET" , url = "/api/metadata_submission/report" )
54
- assert response .status_code == 403
52
+ assert response .status_code == 200
55
53
56
54
57
55
def test_try_edit_locked_submission (db : Session , client : TestClient , logged_in_user ):
0 commit comments