def test_delete_old_runs(self): run_a = api.create_run(run_at=datetime.datetime( 1914, 6, 28, 10, 45, 0)) run_b = api.create_run() api.add_run_metadata({'key': 'value'}, run_b.id) api.add_run_metadata({'key': 'not_so_much_a_value'}, run_a.id) api.delete_old_runs() runs = api.get_all_runs() self.assertEqual(1, len(runs)) self.assertEqual(1, api.get_session().query( models.RunMetadata.id).count()) self.assertEqual(run_b.id, runs[0].id) self.assertEqual(1, len(api.get_run_metadata(run_b.uuid))) self.assertEqual(0, len(api.get_run_metadata(run_a.uuid)))
def test_delete_old_runs(self): run_a = api.create_run( run_at=datetime.datetime(1914, 6, 28, 10, 45, 0)) run_b = api.create_run() api.add_run_metadata({'key': 'value'}, run_b.id) api.add_run_metadata({'key': 'not_so_much_a_value'}, run_a.id) api.delete_old_runs() runs = api.get_all_runs() self.assertEqual(1, len(runs)) self.assertEqual( 1, api.get_session().query(models.RunMetadata.id).count()) self.assertEqual(run_b.id, runs[0].id) self.assertEqual(1, len(api.get_run_metadata(run_b.uuid))) self.assertEqual(0, len(api.get_run_metadata(run_a.uuid)))
def test_create_run_and_list(self): res = api.create_run() self.assertIsNotNone(res) all_runs = api.get_all_runs() self.assertEqual(len(all_runs), 1) self.assertEqual(res.id, all_runs[0].id)