backend/image_markuper/users/tests/test_swagger.py
Alexander-D-Karpov 8d9d0697da inited django
2022-10-25 23:29:13 +03:00

22 lines
558 B
Python

import pytest
from django.urls import reverse
def test_swagger_accessible_by_admin(admin_client):
url = reverse("api-docs")
response = admin_client.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_swagger_ui_not_accessible_by_normal_user(client):
url = reverse("api-docs")
response = client.get(url)
assert response.status_code == 403
def test_api_schema_generated_successfully(admin_client):
url = reverse("api-schema")
response = admin_client.get(url)
assert response.status_code == 200