Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jfuss committed May 5, 2021
1 parent 29bd6de commit 2817379
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
33 changes: 33 additions & 0 deletions tests/swagger/test_swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}})
1 change: 0 additions & 1 deletion tests/translator/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2817379

Please sign in to comment.