diff --git a/tests/swagger/test_swagger.py b/tests/swagger/test_swagger.py index cf6147726..0183da190 100644 --- a/tests/swagger/test_swagger.py +++ b/tests/swagger/test_swagger.py @@ -1456,3 +1456,36 @@ def test_should_include_none_if_default_is_overwritte(self): self.editor.add_auth_to_method("/cognito", "get", auth, self.api) self.assertEqual([{"NONE": []}], self.editor.swagger["paths"]["/cognito"]["get"]["security"]) + +class TestSwaggerEditor_set_path_default_authorizer(TestCase): + def setUp(self): + self.api = api = { + "Auth": { + "Authorizers": {"MyOtherCognitoAuth": {}, "MyCognitoAuth": {}}, + "DefaultAuthorizer": "MyCognitoAuth", + } + } + self.editor = SwaggerEditor( + { + "swagger": "2.0", + "paths": { + "/cognito": { + "nonMethod": { + "x-amazon-apigateway-integration": { + "httpMethod": "POST", + "type": "aws_proxy", + "uri": { + "Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFn.Arn}/invocations" + }, + }, + "security": [], + "responses": {}, + } + } + }, + } + ) + + def test_should_fail_when_path_methods_are_invalid(self): + with self.assertRaises(InvalidDocumentException): + self.editor.set_path_default_authorizer("/cognito", "MyCognitoAuth", {"MyOtherCognitoAuth": {}, "MyCognitoAuth": {}}) diff --git a/tests/translator/test_translator.py b/tests/translator/test_translator.py index 05948913f..27667adeb 100644 --- a/tests/translator/test_translator.py +++ b/tests/translator/test_translator.py @@ -413,7 +413,6 @@ def test_transform_success(self, testcase, partition_with_region): ], # Run all the above tests against each of the list of partitions to test against ) ) - @pytest.mark.slow @patch( "samtranslator.plugins.application.serverless_app_plugin.ServerlessAppPlugin._sar_service_call", mock_sar_service_call,