Beispiel #1
0
    def test_suspects(self):

        expected = self.create('BUILDING', datetime(2000, 01, 01, 1, 1, 1))
        available = self.create('AVAILABLE', datetime(2000, 01, 01, 1, 1, 1))
        not_expected = self.create('BUILDING',
                                   datetime(2000, 01, 01, 1, 1, 25))

        restore = RestoreSuspects(self.conf, self.db)
        # Query the backup suspects for backups older than 10 seconds ago
        results = restore.suspects(
            timedelta(seconds=10), datetime(2000, 01, 01, 1, 1, 30)).all()

        # Assert the correct backups are in the results
        self.assertIn(expected, results)
        self.assertNotIn(available, results)
        self.assertNotIn(not_expected, results)