def test_aws_s3_client(aws_s3_client):
    client = aws_s3_client
    assert isinstance(client, BaseClient)
    assert client.meta.config.region_name == AWS_REGION
    assert client.meta.region_name == AWS_REGION

    resp = client.list_buckets()
    assert response_success(resp)
    assert resp.get("Buckets") == []

    # the event-name mocks are dynamically generated after calling the method
    assert has_moto_mocks(client, "before-send.s3.ListBuckets")
def test_aws_iam_client(aws_iam_client):
    client = aws_iam_client
    assert isinstance(client, BaseClient)
    assert client.meta.config.region_name == "aws-global"  # not AWS_REGION
    assert client.meta.region_name == "aws-global"  # not AWS_REGION

    resp = client.list_roles()
    assert response_success(resp)
    assert resp.get("Roles") == []

    # the event-name mocks are dynamically generated after calling the method
    assert has_moto_mocks(client, "before-send.iam.ListRoles")
def test_aws_ecs_client(aws_ecs_client):
    client = aws_ecs_client
    assert isinstance(client, BaseClient)
    assert client.meta.config.region_name == AWS_REGION
    assert client.meta.region_name == AWS_REGION

    resp = client.list_task_definitions()
    assert response_success(resp)
    assert resp.get("taskDefinitionArns") == []

    # the event-name mocks are dynamically generated after calling the method
    assert has_moto_mocks(client, "before-send.ecs.ListTaskDefinitions")
def test_aws_ec2_client(aws_ec2_client):
    client = aws_ec2_client
    assert isinstance(client, BaseClient)
    assert client.meta.config.region_name == AWS_REGION
    assert client.meta.region_name == AWS_REGION

    resp = client.describe_instances()
    assert response_success(resp)
    assert resp.get("Reservations") == []

    # the event-name mocks are dynamically generated after calling the method
    assert has_moto_mocks(client, "before-send.ec2.DescribeInstances")
Exemple #5
0
async def test_aio_aws_iam_client(aio_aws_iam_client):
    client = aio_aws_iam_client
    assert isinstance(client, AioBaseClient)
    assert client.meta.config.region_name == "aws-global"  # not AWS_REGION
    assert client.meta.region_name == "aws-global"  # not AWS_REGION

    resp = await client.list_roles()
    assert response_success(resp)
    assert resp.get("Roles") == []

    # the event-name mocks are dynamically generated after calling the method;
    # for aio-clients, they should be disabled for aiohttp to hit moto.server.
    assert not has_moto_mocks(client, "before-send.iam.ListRoles")
Exemple #6
0
async def test_aio_aws_ecs_client(aio_aws_ecs_client):
    client = aio_aws_ecs_client
    assert isinstance(client, AioBaseClient)
    assert client.meta.config.region_name == AWS_REGION
    assert client.meta.region_name == AWS_REGION

    resp = await client.list_task_definitions()
    assert response_success(resp)
    assert resp.get("taskDefinitionArns") == []

    # the event-name mocks are dynamically generated after calling the method;
    # for aio-clients, they should be disabled for aiohttp to hit moto.server.
    assert not has_moto_mocks(client, "before-send.ecs.ListTaskDefinitions")
def test_aws_logs_client(aws_logs_client):
    client = aws_logs_client
    assert isinstance(client, BaseClient)
    assert client.meta.config.region_name == AWS_REGION
    assert client.meta.region_name == AWS_REGION

    resp = client.describe_log_groups()
    assert response_success(resp)
    assert resp.get("logGroups") == []

    # the event-name mocks are dynamically generated after calling the method
    assert has_moto_mocks(client,
                          "before-send.cloudwatch-logs.DescribeLogGroups")
Exemple #8
0
async def test_aio_aws_batch_client(aio_aws_batch_client):
    client = aio_aws_batch_client
    assert isinstance(client, AioBaseClient)

    assert client.meta.config.region_name == AWS_REGION
    assert client.meta.region_name == AWS_REGION

    resp = await client.describe_job_queues()
    assert response_success(resp)
    assert resp.get("jobQueues") == []

    # the event-name mocks are dynamically generated after calling the method;
    # for aio-clients, they should be disabled for aiohttp to hit moto.server.
    assert not has_moto_mocks(client, "before-send.batch.DescribeJobQueues")
Exemple #9
0
async def test_aio_aws_client(aio_aws_client):
    # aio_aws_client is an async generator
    # aio_aws_client(service_name) yields a client
    async for client in aio_aws_client("s3"):
        assert isinstance(client, AioBaseClient)
        assert client.meta.config.region_name == AWS_REGION
        assert client.meta.region_name == AWS_REGION

        resp = await client.list_buckets()
        assert response_success(resp)
        assert resp.get("Buckets") == []

        # the event-name mocks are dynamically generated after calling the method;
        # for aio-clients, they should be disabled for aiohttp to hit moto.server.
        assert not has_moto_mocks(client, "before-send.s3.ListBuckets")