Fix: ruff check error in test_resourcegroupstaggingapi.py:wq (#7506)

This commit is contained in:
Akira Noda 2024-03-22 05:27:27 +09:00 committed by GitHub
parent 59ce86c5c7
commit 3293b9c666
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -743,12 +743,14 @@ def test_get_resources_sqs():
assert len(resp["ResourceTagMappingList"]) == 1
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
def create_directory():
ec2_client = boto3.client("ec2", region_name="eu-central-1")
ds_client = boto3.client("ds", region_name="eu-central-1")
directory_id = create_test_directory(ds_client, ec2_client)
return directory_id
@mock_aws
def test_get_resources_workspaces():
workspaces = boto3.client("workspaces", region_name="eu-central-1")
@ -756,26 +758,25 @@ def test_get_resources_workspaces():
# Create two tagged Workspaces
directory_id = create_directory()
workspaces.register_workspace_directory(
DirectoryId=directory_id,
EnableWorkDocs=False
DirectoryId=directory_id, EnableWorkDocs=False
)
workspaces.create_workspaces(
Workspaces=[
{
'DirectoryId': directory_id,
'UserName': 'Administrator',
'BundleId': 'wsb-bh8rsxt14',
'Tags': [
{"Key": "Test", "Value": "1"},
],
"DirectoryId": directory_id,
"UserName": "Administrator",
"BundleId": "wsb-bh8rsxt14",
"Tags": [
{"Key": "Test", "Value": "1"},
],
},
{
'DirectoryId': directory_id,
'UserName': 'Administrator',
'BundleId': 'wsb-bh8rsxt14',
'Tags': [
{"Key": "Test", "Value": "2"},
],
"DirectoryId": directory_id,
"UserName": "Administrator",
"BundleId": "wsb-bh8rsxt14",
"Tags": [
{"Key": "Test", "Value": "2"},
],
},
]
)
@ -794,6 +795,7 @@ def test_get_resources_workspaces():
assert len(resp["ResourceTagMappingList"]) == 1
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
@mock_aws
def test_get_resources_workspace_directories():
workspaces = boto3.client("workspaces", region_name="eu-central-1")
@ -824,6 +826,7 @@ def test_get_resources_workspace_directories():
assert len(resp["ResourceTagMappingList"]) == 1
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
@mock_aws
def test_get_resources_workspace_images():
workspaces = boto3.client("workspaces", region_name="eu-central-1")
@ -831,26 +834,25 @@ def test_get_resources_workspace_images():
# Create two tagged Workspace Images
directory_id = create_directory()
workspaces.register_workspace_directory(
DirectoryId=directory_id,
EnableWorkDocs=False
DirectoryId=directory_id, EnableWorkDocs=False
)
resp = workspaces.create_workspaces(
Workspaces=[
{
'DirectoryId': directory_id,
'UserName': 'Administrator',
'BundleId': 'wsb-bh8rsxt14',
"DirectoryId": directory_id,
"UserName": "Administrator",
"BundleId": "wsb-bh8rsxt14",
},
]
)
workspace_id = resp["PendingRequests"][0]["WorkspaceId"]
for i in range(1, 3):
i_str = str(i)
image = workspaces.create_workspace_image(
Name=f'test-image-{i_str}',
Description='Test workspace image',
_ = workspaces.create_workspace_image(
Name=f"test-image-{i_str}",
Description="Test workspace image",
WorkspaceId=workspace_id,
Tags=[{"Key": "Test", "Value": i_str}]
Tags=[{"Key": "Test", "Value": i_str}],
)
rtapi = boto3.client("resourcegroupstaggingapi", region_name="eu-central-1")
@ -866,6 +868,7 @@ def test_get_resources_workspace_images():
assert len(resp["ResourceTagMappingList"]) == 1
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
@mock_aws
def test_get_resources_sns():
sns = boto3.client("sns", region_name="us-east-1")