Fix: ruff check error in test_resourcegroupstaggingapi.py:wq
(#7506)
This commit is contained in:
parent
59ce86c5c7
commit
3293b9c666
@ -743,12 +743,14 @@ def test_get_resources_sqs():
|
|||||||
assert len(resp["ResourceTagMappingList"]) == 1
|
assert len(resp["ResourceTagMappingList"]) == 1
|
||||||
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
||||||
|
|
||||||
|
|
||||||
def create_directory():
|
def create_directory():
|
||||||
ec2_client = boto3.client("ec2", region_name="eu-central-1")
|
ec2_client = boto3.client("ec2", region_name="eu-central-1")
|
||||||
ds_client = boto3.client("ds", region_name="eu-central-1")
|
ds_client = boto3.client("ds", region_name="eu-central-1")
|
||||||
directory_id = create_test_directory(ds_client, ec2_client)
|
directory_id = create_test_directory(ds_client, ec2_client)
|
||||||
return directory_id
|
return directory_id
|
||||||
|
|
||||||
|
|
||||||
@mock_aws
|
@mock_aws
|
||||||
def test_get_resources_workspaces():
|
def test_get_resources_workspaces():
|
||||||
workspaces = boto3.client("workspaces", region_name="eu-central-1")
|
workspaces = boto3.client("workspaces", region_name="eu-central-1")
|
||||||
@ -756,26 +758,25 @@ def test_get_resources_workspaces():
|
|||||||
# Create two tagged Workspaces
|
# Create two tagged Workspaces
|
||||||
directory_id = create_directory()
|
directory_id = create_directory()
|
||||||
workspaces.register_workspace_directory(
|
workspaces.register_workspace_directory(
|
||||||
DirectoryId=directory_id,
|
DirectoryId=directory_id, EnableWorkDocs=False
|
||||||
EnableWorkDocs=False
|
|
||||||
)
|
)
|
||||||
workspaces.create_workspaces(
|
workspaces.create_workspaces(
|
||||||
Workspaces=[
|
Workspaces=[
|
||||||
{
|
{
|
||||||
'DirectoryId': directory_id,
|
"DirectoryId": directory_id,
|
||||||
'UserName': 'Administrator',
|
"UserName": "Administrator",
|
||||||
'BundleId': 'wsb-bh8rsxt14',
|
"BundleId": "wsb-bh8rsxt14",
|
||||||
'Tags': [
|
"Tags": [
|
||||||
{"Key": "Test", "Value": "1"},
|
{"Key": "Test", "Value": "1"},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'DirectoryId': directory_id,
|
"DirectoryId": directory_id,
|
||||||
'UserName': 'Administrator',
|
"UserName": "Administrator",
|
||||||
'BundleId': 'wsb-bh8rsxt14',
|
"BundleId": "wsb-bh8rsxt14",
|
||||||
'Tags': [
|
"Tags": [
|
||||||
{"Key": "Test", "Value": "2"},
|
{"Key": "Test", "Value": "2"},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -794,6 +795,7 @@ def test_get_resources_workspaces():
|
|||||||
assert len(resp["ResourceTagMappingList"]) == 1
|
assert len(resp["ResourceTagMappingList"]) == 1
|
||||||
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
||||||
|
|
||||||
|
|
||||||
@mock_aws
|
@mock_aws
|
||||||
def test_get_resources_workspace_directories():
|
def test_get_resources_workspace_directories():
|
||||||
workspaces = boto3.client("workspaces", region_name="eu-central-1")
|
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 len(resp["ResourceTagMappingList"]) == 1
|
||||||
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
||||||
|
|
||||||
|
|
||||||
@mock_aws
|
@mock_aws
|
||||||
def test_get_resources_workspace_images():
|
def test_get_resources_workspace_images():
|
||||||
workspaces = boto3.client("workspaces", region_name="eu-central-1")
|
workspaces = boto3.client("workspaces", region_name="eu-central-1")
|
||||||
@ -831,26 +834,25 @@ def test_get_resources_workspace_images():
|
|||||||
# Create two tagged Workspace Images
|
# Create two tagged Workspace Images
|
||||||
directory_id = create_directory()
|
directory_id = create_directory()
|
||||||
workspaces.register_workspace_directory(
|
workspaces.register_workspace_directory(
|
||||||
DirectoryId=directory_id,
|
DirectoryId=directory_id, EnableWorkDocs=False
|
||||||
EnableWorkDocs=False
|
|
||||||
)
|
)
|
||||||
resp = workspaces.create_workspaces(
|
resp = workspaces.create_workspaces(
|
||||||
Workspaces=[
|
Workspaces=[
|
||||||
{
|
{
|
||||||
'DirectoryId': directory_id,
|
"DirectoryId": directory_id,
|
||||||
'UserName': 'Administrator',
|
"UserName": "Administrator",
|
||||||
'BundleId': 'wsb-bh8rsxt14',
|
"BundleId": "wsb-bh8rsxt14",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
workspace_id = resp["PendingRequests"][0]["WorkspaceId"]
|
workspace_id = resp["PendingRequests"][0]["WorkspaceId"]
|
||||||
for i in range(1, 3):
|
for i in range(1, 3):
|
||||||
i_str = str(i)
|
i_str = str(i)
|
||||||
image = workspaces.create_workspace_image(
|
_ = workspaces.create_workspace_image(
|
||||||
Name=f'test-image-{i_str}',
|
Name=f"test-image-{i_str}",
|
||||||
Description='Test workspace image',
|
Description="Test workspace image",
|
||||||
WorkspaceId=workspace_id,
|
WorkspaceId=workspace_id,
|
||||||
Tags=[{"Key": "Test", "Value": i_str}]
|
Tags=[{"Key": "Test", "Value": i_str}],
|
||||||
)
|
)
|
||||||
rtapi = boto3.client("resourcegroupstaggingapi", region_name="eu-central-1")
|
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 len(resp["ResourceTagMappingList"]) == 1
|
||||||
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
assert {"Key": "Test", "Value": "1"} in resp["ResourceTagMappingList"][0]["Tags"]
|
||||||
|
|
||||||
|
|
||||||
@mock_aws
|
@mock_aws
|
||||||
def test_get_resources_sns():
|
def test_get_resources_sns():
|
||||||
sns = boto3.client("sns", region_name="us-east-1")
|
sns = boto3.client("sns", region_name="us-east-1")
|
||||||
|
Loading…
Reference in New Issue
Block a user