Ejemplo n.º 1
0
    def test_swift_delete_older_than(self):
        backup_res = bakthat.backup(self.test_filename, "azure", password="",
                                    profile=self.test_profile)

        #self.assertEqual(bakthat.match_filename(self.test_filename, "swift",
        #                                        profile=self.test_profile
        #                                        )[0]["filename"],
        #                 self.test_filename)

        bakthat.restore(self.test_filename, "azure",
                        profile=self.test_profile)

        restored_hash = hashlib.sha1(
            open(self.test_filename).read()).hexdigest()

        self.assertEqual(self.test_hash, restored_hash)

        #os.remove(self.test_filename)

        test_deleted = bakthat.delete_older_than(self.test_filename, "1Y",
                                                 destination="azure",
                                                 profile=self.test_profile)

        self.assertEqual(test_deleted, [])

        time.sleep(10)

        test_deleted = bakthat.delete_older_than(self.test_filename, "9s",
                                                 destination="azure",
                                                 profile=self.test_profile)

       
        key_deleted = test_deleted[0]

        self.assertEqual(key_deleted, backup_res)
Ejemplo n.º 2
0
    def test_s3_delete_older_than(self):
        backup_res = bakthat.backup(self.test_file.name, "s3", password="")

        self.assertEqual(bakthat.match_filename(self.test_filename, "s3")[0]["filename"],
                        self.test_filename)

        bakthat.restore(self.test_filename, "s3")
        
        restored_hash = hashlib.sha1(open(self.test_filename).read()).hexdigest()
        
        self.assertEqual(self.test_hash, restored_hash)

        os.remove(self.test_filename)

        test_deleted = bakthat.delete_older_than(self.test_filename, "1Y", "s3")

        self.assertEqual(test_deleted, [])

        time.sleep(10)

        test_deleted = bakthat.delete_older_than(self.test_filename, "9s", "s3")

        key_deleted = test_deleted[0]

        self.assertEqual(key_deleted, backup_res["stored_filename"])

        self.assertEqual(bakthat.match_filename(self.test_filename), [])
Ejemplo n.º 3
0
    def test_s3_delete_older_than(self):
        backup_res = bakthat.backup(self.test_file.name, "s3", password="")

        #self.assertEqual(bakthat.match_filename(self.test_filename, "s3")[0]["filename"],
        #                 self.test_filename)

        bakthat.restore(self.test_filename, "s3")

        restored_hash = hashlib.sha1(open(
            self.test_filename).read()).hexdigest()

        self.assertEqual(self.test_hash, restored_hash)

        os.remove(self.test_filename)

        test_deleted = bakthat.delete_older_than(self.test_filename,
                                                 "1Y",
                                                 destination="s3")

        self.assertEqual(test_deleted, [])

        time.sleep(10)

        test_deleted = bakthat.delete_older_than(self.test_filename,
                                                 "9s",
                                                 destination="s3")

        key_deleted = test_deleted[0]

        self.assertEqual(key_deleted.stored_filename,
                         backup_res.stored_filename)
Ejemplo n.º 4
0
    def test_swift_delete_older_than(self):
        backup_res = bakthat.backup(self.test_file.name,
                                    "swift",
                                    password="",
                                    profile=self.test_profile)

        #self.assertEqual(bakthat.match_filename(self.test_filename, "swift",
        #                                        profile=self.test_profile
        #                                        )[0]["filename"],
        #                 self.test_filename)

        bakthat.restore(self.test_filename, "swift", profile=self.test_profile)

        restored_hash = hashlib.sha1(open(
            self.test_filename).read()).hexdigest()

        self.assertEqual(self.test_hash, restored_hash)

        os.remove(self.test_filename)

        test_deleted = bakthat.delete_older_than(self.test_filename,
                                                 "1Y",
                                                 "swift",
                                                 profile=self.test_profile)

        self.assertEqual(test_deleted, [])

        time.sleep(10)

        test_deleted = bakthat.delete_older_than(self.test_filename,
                                                 "9s",
                                                 "swift",
                                                 profile=self.test_profile)

        key_deleted = test_deleted[0]

        self.assertEqual(key_deleted, backup_res["stored_filename"])