Skip to content

Conftest

aws_and_s3_credentials()

Mocked AWS Credentials for moto.

Source code in backend/archiver/flows/tests/conftest.py
 7
 8
 9
10
11
12
13
14
15
16
@pytest.fixture(scope="function")
def aws_and_s3_credentials():
    """Mocked AWS Credentials for moto."""
    os.environ["AWS_ACCESS_KEY_ID"] = "testing"
    os.environ["AWS_SECRET_ACCESS_KEY"] = "testing"
    os.environ["AWS_SECURITY_TOKEN"] = "testing"
    os.environ["AWS_SESSION_TOKEN"] = "testing"
    os.environ["AWS_DEFAULT_REGION"] = "eu-west-1"
    os.environ["MINIO_REGION"] = "eu-west-1"
    os.environ["MINIO_ENDPOINT"] = "endpoint:9000"

mocked_s3(aws_and_s3_credentials)

Mock all AWS interactions Requires you to create your own boto3 clients

Source code in backend/archiver/flows/tests/conftest.py
19
20
21
22
23
24
25
26
@pytest.fixture(scope="function")
def mocked_s3(aws_and_s3_credentials):
    """
    Mock all AWS interactions
    Requires you to create your own boto3 clients
    """
    with mock_aws():
        yield