def test_missing(self): history.start_run() history.report_missing(self.missing) history.finish_run() self.assertEqual(history.missing_files(history.config.SITE), sorted([miss[0] for miss in self.missing]))
def test_dups(self): history.start_run() history.report_missing(self.missing) history.report_orphan(self.missing + self.missing2) history.finish_run() self.assertEqual(history.orphan_files('TEST_SITE_NAME'), sorted([miss[0] for miss in self.missing2]))
def test_act(self): site = picker.pick_site() history.start_run() history.report_empty([('/store/test/empty/dir', 100)]) history.finish_run() self.assertEqual(history.empty_directories(site), ['/store/test/empty/dir']) self.assertEqual(history.empty_directories(site, True), ['/store/test/empty/dir']) self.assertFalse(history.empty_directories(site))
def test_siteunique(self): history.start_run() history.finish_run() history.start_run() history.finish_run() conn, curs = history._connect() curs.execute('SELECT * FROM sites;') result = list(curs.fetchall()) conn.close() self.assertEqual(len(result), 1)
def test_two_sites(self): history.start_run() history.report_missing(self.missing) history.finish_run() history.config.SITE = 'TEST_SITE_NAME_2' history.start_run() history.report_missing(self.missing2) history.finish_run() history.config.SITE = 'TEST_SITE_NAME' self.assertEqual(history.missing_files('TEST_SITE_NAME'), sorted([miss[0] for miss in self.missing])) self.assertEqual(history.missing_files('TEST_SITE_NAME_2'), sorted([miss[0] for miss in self.missing2]))
def test_multiplemissing(self): site = picker.pick_site() history.start_run() history.report_empty([('/store/test/empty/dir', 100)]) history.report_empty([('/store/test/empty/dir', 100)]) history.finish_run() self.assertEqual(history.empty_directories(site), ['/store/test/empty/dir']) history.start_run() history.report_empty([('/store/test/empty/dir2', 100), ('/store/test/empty/dir2', 100)]) history.finish_run() self.assertEqual(history.empty_directories(site), ['/store/test/empty/dir2'])
def test_run(self): history.start_run() self.assertTrue(history.RUN) history.finish_run() self.assertFalse(history.RUN)