fix: storage test
This commit is contained in:
parent
8dfba74682
commit
1f482f2476
@ -2,9 +2,15 @@ import gzip
|
||||
import json
|
||||
import pytest
|
||||
|
||||
from pyinfra.config import get_config
|
||||
from pyinfra.payload_processing.payload import LegacyQueueMessagePayload, QueueMessagePayload
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def settings():
|
||||
return get_config()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def legacy_payload(x_tenant_id, optional_processing_kwargs):
|
||||
x_tenant_entry = {"X-TENANT-ID": x_tenant_id} if x_tenant_id else {}
|
||||
|
||||
@ -1,14 +1,25 @@
|
||||
import logging
|
||||
|
||||
import pytest
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
from pyinfra.storage.storage import get_storage_from_config
|
||||
|
||||
|
||||
@pytest.mark.parametrize("storage_backend", ["azure", "s3"], scope="session")
|
||||
@pytest.mark.parametrize("bucket_name", ["testbucket"], scope="session")
|
||||
@pytest.mark.parametrize("monitoring_enabled", [False], scope="session")
|
||||
@pytest.fixture(scope="session")
|
||||
def storage(storage_backend, bucket_name, settings):
|
||||
settings.storage_backend = storage_backend
|
||||
settings.storage_bucket = bucket_name
|
||||
|
||||
storage = get_storage_from_config(settings)
|
||||
storage.make_bucket(bucket_name)
|
||||
|
||||
yield storage
|
||||
storage.clear_bucket(bucket_name)
|
||||
|
||||
|
||||
# @pytest.mark.parametrize("storage_backend", ["azure", "s3"], scope="session")
|
||||
# FIXME: Azure storage test needs the secret azure connection string
|
||||
# when the config is refactored as file, add this and provide file via bitwarden
|
||||
@pytest.mark.parametrize("storage_backend", ["s3"], scope="session")
|
||||
@pytest.mark.parametrize("bucket_name", ["bucket"], scope="session")
|
||||
class TestStorage:
|
||||
def test_clearing_bucket_yields_empty_bucket(self, storage, bucket_name):
|
||||
storage.clear_bucket(bucket_name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user