def test_db_exists(self): results = ((1, ), ) plugin = dsplugins.MySQLDatabaseExistencePlugin() events = plugin.query_results_to_events(results, Mock()) self.assertEquals(len(events), 0)
def test_db_not_exists(self): results = ((0, ), ) ds = Mock() ds.component = "test" + NAME_SPLITTER + "test" plugin = dsplugins.MySQLDatabaseExistencePlugin() events = plugin.query_results_to_events(results, ds) self.assertEquals(len(events), 1) self.assertEquals(events[0]['eventKey'], 'db_test_dropped') self.assertEquals(events[0]['component'], 'test') self.assertEquals(events[0]['severity'], 2)