Ejemplo n.º 1
0
 def test_that_when_updating_a_function_fails_the_update_function_method_returns_error(self):
     """
     tests False function not updated.
     """
     with patch.dict(boto_lambda.__salt__, {"boto_iam.get_account_id": MagicMock(return_value="1234")}):
         self.conn.update_function_configuration.side_effect = ClientError(error_content, "update_function")
         result = boto_lambda.update_function_config(FunctionName="testfunction", Role="myrole", **conn_parameters)
     self.assertEqual(result.get("error", {}).get("message"), error_message.format("update_function"))
Ejemplo n.º 2
0
    def test_that_when_updating_a_function_succeeds_the_update_function_method_returns_true(self):
        '''
        tests True function updated.
        '''
        with patch.dict(boto_lambda.__salt__, {'boto_iam.get_account_id': MagicMock(return_value='1234')}):
            self.conn.update_function_config.return_value = function_ret
            result = boto_lambda.update_function_config(FunctionName=function_ret['FunctionName'], Role='myrole', **conn_parameters)

        self.assertTrue(result['updated'])
Ejemplo n.º 3
0
    def test_that_when_updating_a_function_succeeds_the_update_function_method_returns_true(self):
        '''
        tests True function updated.
        '''
        with patch.dict(boto_lambda.__salt__, {'boto_iam.get_account_id': MagicMock(return_value='1234')}):
            self.conn.update_function_config.return_value = function_ret
            result = boto_lambda.update_function_config(FunctionName=function_ret['FunctionName'], Role='myrole', **conn_parameters)

        self.assertTrue(result['updated'])
Ejemplo n.º 4
0
 def test_that_when_updating_a_function_fails_the_update_function_method_returns_error(self):
     '''
     tests False function not updated.
     '''
     with patch.dict(boto_lambda.__salt__, {'boto_iam.get_account_id': MagicMock(return_value='1234')}):
         self.conn.update_function_configuration.side_effect = ClientError(error_content, 'update_function')
         result = boto_lambda.update_function_config(FunctionName='testfunction',
                                                 Role='myrole',
                                                 **conn_parameters)
     self.assertEqual(result.get('error', {}).get('message'), error_message.format('update_function'))
Ejemplo n.º 5
0
 def test_that_when_updating_a_function_fails_the_update_function_method_returns_error(self):
     '''
     tests False function not updated.
     '''
     with patch.dict(boto_lambda.__salt__, {'boto_iam.get_account_id': MagicMock(return_value='1234')}):
         self.conn.update_function_configuration.side_effect = ClientError(error_content, 'update_function')
         result = boto_lambda.update_function_config(FunctionName='testfunction',
                                                 Role='myrole',
                                                 **conn_parameters)
     self.assertEqual(result.get('error', {}).get('message'), error_message.format('update_function'))
Ejemplo n.º 6
0
    def test_that_when_updating_a_function_succeeds_the_update_function_method_returns_true(self):
        """
        tests True function updated.
        """
        with patch.dict(boto_lambda.__salt__, {"boto_iam.get_account_id": MagicMock(return_value="1234")}):
            self.conn.update_function_config.return_value = function_ret
            result = boto_lambda.update_function_config(
                FunctionName=function_ret["FunctionName"], Role="myrole", **conn_parameters
            )

        self.assertTrue(result["updated"])
Ejemplo n.º 7
0
    def test_that_when_updating_a_function_succeeds_the_update_function_method_returns_true(
        self, ):
        """
        tests True function updated.
        """
        with patch.dict(
                boto_lambda.__salt__,
            {"boto_iam.get_account_id": MagicMock(return_value="1234")},
        ):
            self.conn.update_function_config.return_value = function_ret
            result = boto_lambda.update_function_config(
                FunctionName=function_ret["FunctionName"],
                Role="myrole",
                **conn_parameters)

        self.assertTrue(result["updated"])
Ejemplo n.º 8
0
 def test_that_when_updating_a_function_fails_the_update_function_method_returns_error(
     self, ):
     """
     tests False function not updated.
     """
     with patch.dict(
             boto_lambda.__salt__,
         {"boto_iam.get_account_id": MagicMock(return_value="1234")},
     ):
         self.conn.update_function_configuration.side_effect = ClientError(
             error_content, "update_function")
         result = boto_lambda.update_function_config(
             FunctionName="testfunction", Role="myrole", **conn_parameters)
     self.assertEqual(
         result.get("error", {}).get("message"),
         error_message.format("update_function"),
     )