Skip to content

Commit

Permalink
Fix: ruff check error in test_resourcegroupstaggingapi.py:wq (#7506)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsugumi-sys authored Mar 21, 2024
1 parent 59ce86c commit 3293b9c
Showing 1 changed file with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -743,39 +743,40 @@ 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")

# 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"},
],
},
]
)
Expand All @@ -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")
Expand Down Expand Up @@ -824,33 +826,33 @@ 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")

# 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")

Expand All @@ -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")
Expand Down

0 comments on commit 3293b9c

Please sign in to comment.