From 2478a3124abf159aec4c60d9a7b615f854d65c98 Mon Sep 17 00:00:00 2001 From: Monty Dawson <wgd23@cam.ac.uk> Date: Tue, 15 Mar 2022 15:00:44 +0000 Subject: [PATCH] Test coverage for openapi code paths --- apigatewayauth/tests/test_openapi.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 apigatewayauth/tests/test_openapi.py diff --git a/apigatewayauth/tests/test_openapi.py b/apigatewayauth/tests/test_openapi.py new file mode 100644 index 0000000..4aaec4d --- /dev/null +++ b/apigatewayauth/tests/test_openapi.py @@ -0,0 +1,24 @@ +from django.test import TestCase + +from apigatewayauth.openapi import any_api_service_security_method_with_scopes + + +class OpenAPITestCase(TestCase): + + def test_any_api_service_security_method_with_scopes(self): + """ + Test that the service definitions are returned for a given set of scopes. + + """ + + self.assertListEqual( + any_api_service_security_method_with_scopes('read', 'write', 'admin'), + [ + { + 'API Service OAuth2 Client Credentials': ['read', 'write', 'admin'] + }, + { + 'API Service OAuth2 Access Code': ['read', 'write', 'admin'] + } + ] + ) -- GitLab