def test_that_when_checking_if_a_rule_exists_and_a_rule_does_not_exist_the_exists_method_returns_false(self): ''' Tests checking rule existence when the rule does not exist ''' self.conn.list_rules.return_value = {'Rules': []} result = boto_cloudwatch_event.exists(Name=rule_name, **conn_parameters) self.assertFalse(result['exists'])
def test_that_when_checking_if_a_rule_exists_and_boto3_returns_an_error_the_rule_exists_method_returns_error(self): ''' Tests checking rule existence when boto returns an error ''' self.conn.list_rules.side_effect = ClientError(error_content, 'list_rules') result = boto_cloudwatch_event.exists(Name=rule_name, **conn_parameters) self.assertEqual(result.get('error', {}).get('message'), error_message.format('list_rules'))
def test_that_when_checking_if_a_rule_exists_and_a_rule_exists_the_rule_exists_method_returns_true(self): ''' Tests checking event existence when the event already exists ''' self.conn.list_rules.return_value = {'Rules': [rule_ret]} result = boto_cloudwatch_event.exists(Name=rule_name, **conn_parameters) self.assertTrue(result['exists'])
def test_that_when_checking_if_a_rule_exists_and_a_rule_does_not_exist_the_exists_method_returns_false( self, ): """ Tests checking rule existence when the rule does not exist """ self.conn.list_rules.return_value = {"Rules": []} result = boto_cloudwatch_event.exists(Name=rule_name, **conn_parameters) assert not result["exists"]
def test_that_when_checking_if_a_rule_exists_and_a_rule_exists_the_rule_exists_method_returns_true( self, ): """ Tests checking event existence when the event already exists """ self.conn.list_rules.return_value = {"Rules": [rule_ret]} result = boto_cloudwatch_event.exists(Name=rule_name, **conn_parameters) assert result["exists"]
def test_that_when_checking_if_a_rule_exists_and_boto3_returns_an_error_the_rule_exists_method_returns_error( self, ): """ Tests checking rule existence when boto returns an error """ self.conn.list_rules.side_effect = ClientError(error_content, "list_rules") result = boto_cloudwatch_event.exists(Name=rule_name, **conn_parameters) assert result.get( "error", {}).get("message") == error_message.format("list_rules")