kopia lustrzana https://github.com/bellingcat/auto-archiver
Fixed setup/ config_setup reference
rodzic
1792e02d1d
commit
89d9140d15
|
@ -7,7 +7,7 @@ from auto_archiver.core.metadata import Metadata
|
||||||
from tests.storages.test_storage_base import TestStorageBase
|
from tests.storages.test_storage_base import TestStorageBase
|
||||||
|
|
||||||
|
|
||||||
class TestGDriveStorage(TestStorageBase):
|
class TestGDriveStorage:
|
||||||
"""
|
"""
|
||||||
Test suite for GDriveStorage.
|
Test suite for GDriveStorage.
|
||||||
"""
|
"""
|
||||||
|
@ -21,6 +21,10 @@ class TestGDriveStorage(TestStorageBase):
|
||||||
'service_account': 'fake_service_account.json'
|
'service_account': 'fake_service_account.json'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def gdrive(self, setup_module):
|
||||||
|
with patch('google.oauth2.service_account.Credentials.from_service_account_file') as mock_creds:
|
||||||
|
self.storage = setup_module(self.module_name, self.config)
|
||||||
|
|
||||||
def test_initialize_fails_with_non_existent_creds(self):
|
def test_initialize_fails_with_non_existent_creds(self):
|
||||||
"""
|
"""
|
||||||
|
@ -28,13 +32,15 @@ class TestGDriveStorage(TestStorageBase):
|
||||||
"""
|
"""
|
||||||
# Act and Assert
|
# Act and Assert
|
||||||
with pytest.raises(FileNotFoundError) as exc_info:
|
with pytest.raises(FileNotFoundError) as exc_info:
|
||||||
self.storage.setup(self.config)
|
self.storage.setup()
|
||||||
assert "No such file or directory" in str(exc_info.value)
|
assert "No such file or directory" in str(exc_info.value)
|
||||||
|
|
||||||
|
|
||||||
def test_path_parts(self):
|
def test_path_parts(self):
|
||||||
media = Media(filename="test.jpg")
|
media = Media(filename="test.jpg")
|
||||||
media.key = "folder1/folder2/test.jpg"
|
media.key = "folder1/folder2/test.jpg"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Requires real credentials")
|
@pytest.mark.skip(reason="Requires real credentials")
|
||||||
@pytest.mark.download
|
@pytest.mark.download
|
||||||
class TestGDriveStorageConnected(TestStorageBase):
|
class TestGDriveStorageConnected(TestStorageBase):
|
||||||
|
|
Ładowanie…
Reference in New Issue