mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Fixed unit tests.
This commit is contained in:
@@ -197,7 +197,8 @@ REST_FRAMEWORK = {
|
||||
SPECTACULAR_SETTINGS = {
|
||||
'SCHEMA_PATH_PREFIX': r'/api/v1',
|
||||
'TITLE': 'Modoboa API',
|
||||
'VERSION': '1.0.0'
|
||||
'VERSION': '1.0.0',
|
||||
'SERVE_PERMISSIONS': ['rest_framework.permissions.IsAuthenticated'],
|
||||
}
|
||||
|
||||
# Modoboa settings
|
||||
|
||||
@@ -4,16 +4,13 @@ from modoboa.lib.tests import ModoTestCase
|
||||
|
||||
|
||||
class OpenAPITestCase(ModoTestCase):
|
||||
openapi_schema_url = reverse_lazy('openapi_schema')
|
||||
openapi_schema_url = reverse_lazy('schema')
|
||||
|
||||
def test_unauthorized(self):
|
||||
self.client.logout()
|
||||
|
||||
response = self.client.get("/docs/api/")
|
||||
self.assertRedirects(response, "/accounts/login/?next=/docs/api/")
|
||||
|
||||
response = self.client.get(self.openapi_schema_url)
|
||||
self.assertEqual(response.status_code, 403)
|
||||
self.assertEqual(response.status_code, 401)
|
||||
|
||||
def test_get_schema(self):
|
||||
self.assertEqual(self.openapi_schema_url, "/docs/openapi.json")
|
||||
@@ -24,7 +21,3 @@ class OpenAPITestCase(ModoTestCase):
|
||||
'title': "Modoboa API",
|
||||
'version': "1.0.0",
|
||||
})
|
||||
|
||||
def test_get_swagger_ui(self):
|
||||
response = self.client.get("/docs/api/")
|
||||
self.assertContains(response, "Modoboa API")
|
||||
|
||||
@@ -191,7 +191,8 @@ REST_FRAMEWORK = {
|
||||
SPECTACULAR_SETTINGS = {
|
||||
'SCHEMA_PATH_PREFIX': r'/api/v1',
|
||||
'TITLE': 'Modoboa API',
|
||||
'VERSION': '1.0.0'
|
||||
'VERSION': '1.0.0',
|
||||
'SERVE_PERMISSIONS': ['rest_framework.permissions.IsAuthenticated'],
|
||||
}
|
||||
|
||||
# Modoboa settings
|
||||
|
||||
Reference in New Issue
Block a user