Example #1
0
    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]))
Example #2
0
    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]))
Example #3
0
    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))
Example #4
0
    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)
Example #5
0
    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]))
Example #6
0
    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'])
Example #7
0
 def test_run(self):
     history.start_run()
     self.assertTrue(history.RUN)
     history.finish_run()
     self.assertFalse(history.RUN)