From 4c49d43f573c4095dbfa4e57e9138e3875babfef Mon Sep 17 00:00:00 2001 From: Anuj-Gupta4 Date: Tue, 26 Nov 2024 15:41:53 +0545 Subject: [PATCH] feat(tests): get submission count test --- src/backend/tests/test_submission_routes.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/backend/tests/test_submission_routes.py b/src/backend/tests/test_submission_routes.py index f5ea5ddeb6..b905d62a62 100644 --- a/src/backend/tests/test_submission_routes.py +++ b/src/backend/tests/test_submission_routes.py @@ -93,6 +93,24 @@ async def test_download_submission_file(client, submission): assert len(response.content) > 0, "Expected non-empty ZIP file content" +async def test_get_submission_count(client, submission): + """Test fetching the submission count for a project.""" + odk_project = submission["project"] + + response = await client.get( + f"/submission/get-submission-count?project_id={odk_project.id}" + ) + assert ( + response.status_code == 200 + ), f"Failed to fetch submission count. Response: {response.text}" + + submission_count = response.json() + assert isinstance( + submission_count, int + ), "Expected submission count to be an integer" + assert submission_count > 0, "Submission count should be greater than zero" + + if __name__ == "__main__": """Main func if file invoked directly.""" pytest.main()