diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index ca1ffad329..c4934e6377 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -433,9 +433,7 @@ def remove_aws_dockerfile(): def remove_drf_starter_files(): os.remove(os.path.join("config", "api_router.py")) shutil.rmtree(os.path.join("{{cookiecutter.project_slug}}", "users", "api")) - os.remove(os.path.join("{{cookiecutter.project_slug}}", "users", "tests", "test_drf_urls.py")) - os.remove(os.path.join("{{cookiecutter.project_slug}}", "users", "tests", "test_drf_views.py")) - os.remove(os.path.join("{{cookiecutter.project_slug}}", "users", "tests", "test_swagger.py")) + shutil.rmtree(os.path.join("{{cookiecutter.project_slug}}", "users", "tests", "api")) def main(): diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/__init__.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_swagger.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/test_openapi.py similarity index 81% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_swagger.py rename to {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/test_openapi.py index 5db371dbe8..cb3f19d3da 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_swagger.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/test_openapi.py @@ -4,14 +4,14 @@ from django.urls import reverse -def test_swagger_accessible_by_admin(admin_client): +def test_api_docs_accessible_by_admin(admin_client): url = reverse("api-docs") response = admin_client.get(url) assert response.status_code == HTTPStatus.OK @pytest.mark.django_db -def test_swagger_ui_not_accessible_by_normal_user(client): +def test_api_docs_not_accessible_by_anonymous_users(client): url = reverse("api-docs") response = client.get(url) assert response.status_code == HTTPStatus.FORBIDDEN diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/test_urls.py similarity index 100% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_urls.py rename to {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/test_urls.py diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/test_views.py similarity index 100% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_views.py rename to {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/api/test_views.py