mirror of
https://github.com/leaders-of-digital-9-task/backend.git
synced 2024-11-15 05:56:34 +03:00
22 lines
558 B
Python
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
|