fix(auth): keep SSO compatibility route out of OpenAPI
This commit is contained in:
@@ -39,6 +39,26 @@ class SsoStartViewTest(SimpleTestCase):
|
||||
{"target": ["fkc"], "path": ["/open-data?scope=rosatom"]},
|
||||
)
|
||||
|
||||
def test_callback_alias_does_not_duplicate_openapi_operations(self):
|
||||
from core.api_v1_urls import urlpatterns
|
||||
from drf_yasg import openapi
|
||||
from drf_yasg.generators import OpenAPISchemaGenerator
|
||||
|
||||
schema = OpenAPISchemaGenerator(
|
||||
info=openapi.Info(title="SSO", default_version="v1"),
|
||||
patterns=[
|
||||
item for item in urlpatterns if str(item.pattern).startswith("auth/sso")
|
||||
],
|
||||
).get_schema(request=None, public=True)
|
||||
operations = [
|
||||
operation.operation_id
|
||||
for item in schema.paths.values()
|
||||
for _, operation in item.operations
|
||||
]
|
||||
self.assertEqual(len(operations), len(set(operations)))
|
||||
self.assertIn("/sso/", schema.paths)
|
||||
self.assertNotIn("/sso", schema.paths)
|
||||
|
||||
def test_rejects_absolute_redirect_path(self):
|
||||
response = self.client.get(
|
||||
"/api/v1/auth/sso/start/",
|
||||
|
||||
Reference in New Issue
Block a user