def test_lambda_function_bad_error_propagates(self, stubbed_session): stubbed_session.stub('lambda').get_function(FunctionName='myappname')\ .raises_error(error_code='UnexpectedError', message='Unknown') stubbed_session.activate_stubs() awsclient = TypedAWSClient(stubbed_session) with pytest.raises(botocore.exceptions.ClientError): awsclient.lambda_function_exists(name='myappname') stubbed_session.verify_stubs()
def test_can_query_lambda_function_exists(self, stubbed_session): stubbed_session.stub('lambda').get_function(FunctionName='myappname')\ .returns({'Code': {}, 'Configuration': {}}) stubbed_session.activate_stubs() awsclient = TypedAWSClient(stubbed_session) assert awsclient.lambda_function_exists(name='myappname') stubbed_session.verify_stubs()
def test_can_query_lambda_function_does_not_exist(self, stubbed_session): stubbed_session.stub('lambda').get_function(FunctionName='myappname')\ .raises_error(error_code='ResourceNotFoundException', message='ResourceNotFound') stubbed_session.activate_stubs() awsclient = TypedAWSClient(stubbed_session) assert not awsclient.lambda_function_exists(name='myappname') stubbed_session.verify_stubs()