diff --git a/api/app/tests/__init__.py b/api/app/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/api/app/tests/test_urls.py b/api/app/tests/test_urls.py deleted file mode 100644 index e6b1e6a834ab..000000000000 --- a/api/app/tests/test_urls.py +++ /dev/null @@ -1,16 +0,0 @@ -from django.urls import reverse -from rest_framework import status -from rest_framework.test import APITestCase - - -class HealthChecksTestCase(APITestCase): - def test_health_check_endpoint_returns_200(self): - # Given - base_url = reverse("health:health_check_home") - url = base_url + "?format=json" - - # When - res = self.client.get(url) - - # Then - assert res.status_code == status.HTTP_200_OK diff --git a/api/app_analytics/tests/__init__.py b/api/app_analytics/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/api/tests/unit/app/test_unit_app_urls.py b/api/tests/unit/app/test_unit_app_urls.py new file mode 100644 index 000000000000..99eaf8ff7102 --- /dev/null +++ b/api/tests/unit/app/test_unit_app_urls.py @@ -0,0 +1,15 @@ +from django.urls import reverse +from rest_framework import status +from rest_framework.test import APIClient + + +def test_health_check_endpoint_returns_200(db: None, api_client: APIClient): + # Given + base_url = reverse("health:health_check_home") + url = base_url + "?format=json" + + # When + res = api_client.get(url) + + # Then + assert res.status_code == status.HTTP_200_OK diff --git a/api/app_analytics/tests/test_influxdb_wrapper.py b/api/tests/unit/app_analytics/test_unit_app_analytics_influxdb_wrapper.py similarity index 100% rename from api/app_analytics/tests/test_influxdb_wrapper.py rename to api/tests/unit/app_analytics/test_unit_app_analytics_influxdb_wrapper.py diff --git a/api/app_analytics/tests/test_unit_track.py b/api/tests/unit/app_analytics/test_unit_app_analytics_track.py similarity index 100% rename from api/app_analytics/tests/test_unit_track.py rename to api/tests/unit/app_analytics/test_unit_app_analytics_track.py diff --git a/api/audit/tests/test_views.py b/api/tests/unit/audit/test_unit_audit_views.py similarity index 88% rename from api/audit/tests/test_views.py rename to api/tests/unit/audit/test_unit_audit_views.py index 709a58b45806..f64ba6caedba 100644 --- a/api/audit/tests/test_views.py +++ b/api/tests/unit/audit/test_unit_audit_views.py @@ -11,7 +11,9 @@ from projects.models import Project -def test_audit_log_can_be_filtered_by_environments(admin_client, project, environment): +def test_audit_log_can_be_filtered_by_environments( + admin_client: APIClient, project: Project, environment: Environment +) -> None: # Given audit_env = Environment.objects.create(name="env_n", project=project) @@ -30,7 +32,9 @@ def test_audit_log_can_be_filtered_by_environments(admin_client, project, enviro assert response.json()["results"][0]["environment"]["id"] == audit_env.id -def test_audit_log_can_be_filtered_by_log_text(admin_client, project, environment): +def test_audit_log_can_be_filtered_by_log_text( + admin_client: APIClient, project: Project, environment: Environment +) -> None: # Given flag_state_updated_log = "Flag state updated" flag_state_deleted_log = "flag state deleted" @@ -52,8 +56,11 @@ def test_audit_log_can_be_filtered_by_log_text(admin_client, project, environmen def test_audit_log_can_be_filtered_by_project( - admin_client, project, environment, organisation -): + admin_client: APIClient, + project: Project, + environment: Environment, + organisation: Organisation, +) -> None: # Given another_project = Project.objects.create( name="another_project", organisation=organisation @@ -75,8 +82,11 @@ def test_audit_log_can_be_filtered_by_project( def test_audit_log_can_be_filtered_by_is_system_event( - admin_client, project, environment, organisation -): + admin_client: APIClient, + project: Project, + environment: Environment, + organisation: Organisation, +) -> None: # Given AuditLog.objects.create(project=project, is_system_event=True) AuditLog.objects.create( @@ -100,7 +110,7 @@ def test_regular_user_cannot_list_audit_log( organisation: Organisation, django_user_model: typing.Type[Model], api_client: APIClient, -): +) -> None: # Given AuditLog.objects.create(environment=environment) url = reverse("api-v1:audit-list") @@ -120,7 +130,7 @@ def test_admin_user_cannot_list_audit_log_of_another_organisation( organisation: Organisation, project: Project, django_user_model: typing.Type[Model], -): +) -> None: # Given another_organisation = Organisation.objects.create(name="another organisation") user = django_user_model.objects.create(email="test@example.com")