Exemplo n.º 1
0
    def test_delete(self, mock_storage_obj):
        disk_storage_backend = DiskStorageBackend()
        mock_storage_obj.container = False
        mock_storage_obj.content_location_value = self.datadir

        self.assertTrue(os.path.exists(self.datadir))

        disk_storage_backend.delete(mock_storage_obj)

        self.assertFalse(os.path.exists(self.datadir))
Exemplo n.º 2
0
    def test_delete_container(self, mock_storage_obj):
        disk_storage_backend = DiskStorageBackend()

        aic_pk = 1234
        archive_filename = "archive_file"
        xml_file = self.create_file(archive_filename, "xml")
        aic_xml = self.create_file(aic_pk, "xml")
        tar_path = self.create_container_files(archive_filename, "tar")

        mock_storage_obj.container = True
        mock_storage_obj.ip.aic.pk = aic_pk
        mock_storage_obj.content_location_value = tar_path

        self.assertTrue(os.path.exists(xml_file))
        self.assertTrue(os.path.exists(aic_xml))
        self.assertTrue(os.path.exists(tar_path))

        disk_storage_backend.delete(mock_storage_obj)

        self.assertFalse(os.path.exists(xml_file))
        self.assertFalse(os.path.exists(aic_xml))
        self.assertFalse(os.path.exists(tar_path))