def test_get(self): self.pollute_events(10) yield Anomalies().run() yield Statistics().run() handler = self.request({}, role='admin') response = yield handler.get() # be sure that AnomalyHistory is populated self.assertTrue(isinstance(response, list)) self.assertEqual(len(response), 1)
def test_get(self): self.pollute_events(3) yield Statistics().run() handler = self.request({}, role='admin') response = yield handler.get() self.assertTrue(isinstance(response, list)) for k in ['id', 'duration', 'event', 'creation_date']: for elem in response: self.assertTrue(k in elem)
def test_get(self): handler = self.request({}, role='admin') response = yield handler.get(0) self.assertEqual(len(response), 3) self.assertEqual(len(response['heatmap']), 7 * 24) self.pollute_events(10) yield Anomalies().run() yield Statistics().run() for i in range(2): handler = self.request({}, role='admin') response = yield handler.get(i) self.assertEqual(len(response), 3) self.assertEqual(len(response['heatmap']), 7 * 24)
def test_get(self): self.pollute_events(3) yield Statistics().run() handler = self.request({}, role='admin') response = yield handler.get('details') self.assertTrue(isinstance(response, list)) for k in ['id', 'duration', 'event', 'creation_date']: for elem in response: self.assertTrue(k in elem) response = yield handler.get('summary') self.assertTrue(isinstance(response, dict)) for k in anomaly.ANOMALY_MAP: self.assertTrue(k in response)