add pytests to check if a configured bucket can be found

This commit is contained in:
Francisco Schulz 2022-10-13 11:26:58 +02:00
parent 5b948fdcc5
commit 843d91c61a
3 changed files with 20 additions and 0 deletions

View File

15
tests/conftest.py Normal file
View File

@ -0,0 +1,15 @@
from distutils.command.config import config
import pytest
from pyinfra.config import get_config
import os
@pytest.fixture(params=)
def storage_config(request):
if request.param == "s3":
os.environ["STORAGE_BACKEND"] = "s3"
os.environ["STORAGE_BUCKET_NAME"] = "pyinfra-test-bucket"
else:
os.environ["STORAGE_BACKEND"] = "aks"
os.environ["STORAGE_AZURECONTAINERNAME"] = "pyinfra-test-bucket"
return get_config()

5
tests/test_storage.py Normal file
View File

@ -0,0 +1,5 @@
from pyinfra.storage import get_storage
def test_storage(storage_config) -> None:
storage = get_storage(storage_config)
assert storage.has_bucket(storage_config.storage_bucket)