def test_that_when_checking_if_a_function_exists_and_a_function_does_not_exist_the_function_exists_method_returns_false(self):
        '''
        Tests checking lambda function existence when the lambda function does not exist
        '''
        self.conn.list_functions.return_value = {'Functions': [function_ret]}
        func_exists_result = boto_lambda.function_exists(FunctionName='myfunc', **conn_parameters)

        self.assertFalse(func_exists_result['exists'])
    def test_that_when_checking_if_a_function_exists_and_boto3_returns_an_error_the_function_exists_method_returns_error(self):
        '''
        Tests checking lambda function existence when boto returns an error
        '''
        self.conn.list_functions.side_effect = ClientError(error_content, 'list_functions')
        func_exists_result = boto_lambda.function_exists(FunctionName='myfunc', **conn_parameters)

        self.assertEqual(func_exists_result.get('error', {}).get('message'), error_message.format('list_functions'))
Example #3
0
    def test_that_when_checking_if_a_function_exists_and_boto3_returns_an_error_the_function_exists_method_returns_error(self):
        '''
        Tests checking lambda function existence when boto returns an error
        '''
        self.conn.list_functions.side_effect = ClientError(error_content, 'list_functions')
        func_exists_result = boto_lambda.function_exists(FunctionName='myfunc', **conn_parameters)

        self.assertEqual(func_exists_result.get('error', {}).get('message'), error_message.format('list_functions'))
    def test_that_when_checking_if_a_function_exists_and_a_function_exists_the_function_exists_method_returns_true(self):
        '''
        Tests checking lambda function existence when the lambda function already exists
        '''
        self.conn.list_functions.return_value = {'Functions': [function_ret]}
        func_exists_result = boto_lambda.function_exists(FunctionName=function_ret['FunctionName'], **conn_parameters)

        self.assertTrue(func_exists_result['exists'])
Example #5
0
    def test_that_when_checking_if_a_function_exists_and_a_function_does_not_exist_the_function_exists_method_returns_false(self):
        '''
        Tests checking lambda function existence when the lambda function does not exist
        '''
        self.conn.list_functions.return_value = {'Functions': [function_ret]}
        func_exists_result = boto_lambda.function_exists(FunctionName='myfunc', **conn_parameters)

        self.assertFalse(func_exists_result['exists'])
Example #6
0
    def test_that_when_checking_if_a_function_exists_and_a_function_exists_the_function_exists_method_returns_true(self):
        '''
        Tests checking lambda function existence when the lambda function already exists
        '''
        self.conn.list_functions.return_value = {'Functions': [function_ret]}
        func_exists_result = boto_lambda.function_exists(FunctionName=function_ret['FunctionName'], **conn_parameters)

        self.assertTrue(func_exists_result['exists'])
    def test_that_when_checking_if_a_function_exists_and_a_function_does_not_exist_the_function_exists_method_returns_false(
        self, ):
        """
        Tests checking lambda function existence when the lambda function does not exist
        """
        self.conn.list_functions.return_value = {"Functions": [function_ret]}
        func_exists_result = boto_lambda.function_exists(FunctionName="myfunc",
                                                         **conn_parameters)

        self.assertFalse(func_exists_result["exists"])
    def test_that_when_checking_if_a_function_exists_and_a_function_exists_the_function_exists_method_returns_true(
        self, ):
        """
        Tests checking lambda function existence when the lambda function already exists
        """
        self.conn.list_functions.return_value = {"Functions": [function_ret]}
        func_exists_result = boto_lambda.function_exists(
            FunctionName=function_ret["FunctionName"], **conn_parameters)

        self.assertTrue(func_exists_result["exists"])
Example #9
0
    def test_that_when_checking_if_a_function_exists_and_boto3_returns_an_error_the_function_exists_method_returns_error(
        self
    ):
        """
        Tests checking lambda function existence when boto returns an error
        """
        self.conn.list_functions.side_effect = ClientError(error_content, "list_functions")
        func_exists_result = boto_lambda.function_exists(FunctionName="myfunc", **conn_parameters)

        self.assertEqual(func_exists_result.get("error", {}).get("message"), error_message.format("list_functions"))
Example #10
0
    def test_that_when_checking_if_a_function_exists_and_a_function_does_not_exist_the_function_exists_method_returns_false(
        self
    ):
        """
        Tests checking lambda function existence when the lambda function does not exist
        """
        self.conn.list_functions.return_value = {"Functions": [function_ret]}
        func_exists_result = boto_lambda.function_exists(FunctionName="myfunc", **conn_parameters)

        self.assertFalse(func_exists_result["exists"])
Example #11
0
    def test_that_when_checking_if_a_function_exists_and_boto3_returns_an_error_the_function_exists_method_returns_error(
        self,
    ):
        """
        Tests checking lambda function existence when boto returns an error
        """
        self.conn.list_functions.side_effect = ClientError(error_content, "list_functions")
        func_exists_result = boto_lambda.function_exists(FunctionName="myfunc", **conn_parameters)

        assert func_exists_result.get("error", {}).get("message") == error_message.format(
            "list_functions"
        )