def test_same_recipient_duplicity_allowed(self): alert.ensure_recipient_value_is_unique(self.mock_reporter, self.alert, "value1", recipient_id="rec-1", allow_duplicity=True) self.assertEqual(0, len(self.mock_reporter.report_item_list))
def test_not_unique_duplicity_allowed(self): alert.ensure_recipient_value_is_unique(self.mock_reporter, self.alert, "value1", allow_duplicity=True) assert_report_item_list_equal( self.mock_reporter.report_item_list, [(severities.WARNING, report_codes.CIB_ALERT_RECIPIENT_ALREADY_EXISTS, { "alert": "alert-1", "recipient": "value1" })])
def test_not_unique_duplicity_allowed(self): alert.ensure_recipient_value_is_unique( self.mock_reporter, self.alert, "value1", allow_duplicity=True ) assert_report_item_list_equal( self.mock_reporter.report_item_list, [( severities.WARNING, report_codes.CIB_ALERT_RECIPIENT_ALREADY_EXISTS, { "alert": "alert-1", "recipient": "value1" } )] )
def test_not_unique_no_duplicity_allowed(self): report_item = (severities.ERROR, report_codes.CIB_ALERT_RECIPIENT_ALREADY_EXISTS, { "alert": "alert-1", "recipient": "value1" }, report_codes.FORCE_ALERT_RECIPIENT_VALUE_NOT_UNIQUE) assert_raise_library_error( lambda: alert.ensure_recipient_value_is_unique( self.mock_reporter, self.alert, "value1"), report_item) assert_report_item_list_equal(self.mock_reporter.report_item_list, [report_item])
def test_not_unique_no_duplicity_allowed(self): report_item = ( severities.ERROR, report_codes.CIB_ALERT_RECIPIENT_ALREADY_EXISTS, { "alert": "alert-1", "recipient": "value1" }, report_codes.FORCE_ALERT_RECIPIENT_VALUE_NOT_UNIQUE ) assert_raise_library_error( lambda: alert.ensure_recipient_value_is_unique( self.mock_reporter, self.alert, "value1" ), report_item ) assert_report_item_list_equal( self.mock_reporter.report_item_list, [report_item] )
def test_is_unique_no_duplicity_allowed(self): alert.ensure_recipient_value_is_unique(self.mock_reporter, self.alert, "value2") self.assertEqual(0, len(self.mock_reporter.report_item_list))
def test_is_unique_duplicity_allowed(self): alert.ensure_recipient_value_is_unique( self.mock_reporter, self.alert, "value2", allow_duplicity=True ) self.assertEqual(0, len(self.mock_reporter.report_item_list))
def test_same_recipient_no_duplicity_allowed(self): alert.ensure_recipient_value_is_unique( self.mock_reporter, self.alert, "value1", recipient_id="rec-1" ) self.assertEqual(0, len(self.mock_reporter.report_item_list))