File: test_appsync_integration.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (27 lines) | stat: -rw-r--r-- 877 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import boto3

from moto import mock_aws


@mock_aws
def test_resource_groups_tagging_api():
    region = "us-west-2"
    client = boto3.client("appsync", region_name=region)
    rtapi_client = boto3.client("resourcegroupstaggingapi", region_name=region)

    api = client.create_graphql_api(
        name="api-with-tags",
        authenticationType="API_KEY",
        tags={"key": "val", "key2": "val2"},
    )["graphqlApi"]
    client.create_graphql_api(name="api-no-tags", authenticationType="API_KEY")[
        "graphqlApi"
    ]

    resp = rtapi_client.get_resources(ResourceTypeFilters=["appsync"])
    assert len(resp["ResourceTagMappingList"]) == 1
    assert resp["ResourceTagMappingList"][0]["ResourceARN"] == api["arn"]
    assert resp["ResourceTagMappingList"][0]["Tags"] == [
        {"Key": "key", "Value": "val"},
        {"Key": "key2", "Value": "val2"},
    ]