예제 #1
0
def test_tag_resource_error_not_exists():
    # given
    region_name = "eu-central-1"
    client = boto3.client("cloudwatch", region_name=region_name)

    # when
    with pytest.raises(ClientError) as e:
        client.tag_resource(
            ResourceARN=make_arn_for_alarm(region=region_name,
                                           account_id=ACCOUNT_ID,
                                           alarm_name="unknown"),
            Tags=[
                {
                    "Key": "key-1",
                    "Value": "value-1"
                },
            ],
        )

    # then
    ex = e.value
    ex.operation_name.should.equal("TagResource")
    ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(404)
    ex.response["Error"]["Code"].should.contain("ResourceNotFoundException")
    ex.response["Error"]["Message"].should.equal("Unknown")
예제 #2
0
def test_list_tags_for_resource_with_unknown_resource():
    # given
    region_name = "eu-central-1"
    client = boto3.client("cloudwatch", region_name=region_name)

    # when
    response = client.list_tags_for_resource(ResourceARN=make_arn_for_alarm(
        region=region_name, account_id=ACCOUNT_ID, alarm_name="unknown"))

    # then
    response["Tags"].should.be.empty