def testAnomalyInfoDicts(self): testing_common.AddTests(['M'], ['b'], {'t': {'foo': {}}}) foo_key = utils.TestKey('M/b/t/foo') foo_anomaly = anomaly.Anomaly( start_revision=14999, end_revision=15000, test=foo_key, bug_id=12345, median_before_anomaly=100, median_after_anomaly=200) anomaly_key = foo_anomaly.put() self.assertEqual( [ { 'master': 'M', 'bot': 'b', 'testsuite': 't', 'test': 'foo', 'bug_id': 12345, 'start_revision': 14999, 'end_revision': 15000, 'key': anomaly_key.urlsafe(), 'dashboard_link': ('https://chromeperf.appspot.com' '/group_report?keys=%s' % anomaly_key.urlsafe()), 'percent_changed': '100.0%', 'color_class': 'over-50', 'improvement': False, } ], main._AnomalyInfoDicts([foo_anomaly], {foo_key: foo_key.get()}))
def testAnomalyInfoDicts_MissingTest_AnomalySkipped(self): testing_common.AddTests(['M'], ['b'], {'t': {'foo': {}}}) foo_key = utils.TestKey('M/b/t/foo') foo_anomaly = anomaly.Anomaly( start_revision=14999, end_revision=15000, test=foo_key, bug_id=12345, median_before_anomaly=100, median_after_anomaly=200) foo_anomaly.put() self.assertEqual([], main._AnomalyInfoDicts([foo_anomaly], {}))