Skip to content

Commit

Permalink
Workspaces Web: Fix tags and user settings (#8214)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamarcelin authored Oct 8, 2024
1 parent c8f1270 commit 21873d1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 26 deletions.
12 changes: 6 additions & 6 deletions moto/workspacesweb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ def __init__(
self.additional_encryption_context = additional_encryption_context
self.client_token = client_token
self.cookie_synchronization_configuration = cookie_synchronization_configuration
self.copy_allowed = "Enabled" if copy_allowed else "Disabled"
self.copy_allowed = copy_allowed if copy_allowed else "Disabled"
self.customer_managed_key = customer_managed_key
self.deep_link_allowed = "Enabled" if deep_link_allowed else "Disabled"
self.deep_link_allowed = deep_link_allowed if deep_link_allowed else "Disabled"
self.disconnect_timeout_in_minutes = disconnect_timeout_in_minutes
self.download_allowed = "Enabled" if download_allowed else "Disabled"
self.download_allowed = download_allowed if download_allowed else "Disabled"
self.idle_disconnect_timeout_in_minutes = idle_disconnect_timeout_in_minutes
self.paste_allowed = "Enabled" if paste_allowed else "Disabled"
self.print_allowed = "Enabled" if print_allowed else "Disabled"
self.paste_allowed = paste_allowed if paste_allowed else "Disabled"
self.print_allowed = print_allowed if print_allowed else "Disabled"
self.tags = tags
self.upload_allowed = "Enabled" if upload_allowed else "Disabled"
self.upload_allowed = upload_allowed if upload_allowed else "Disabled"
self.associated_portal_arns: List[str] = []

def arn_formatter(self, _id: str, account_id: str, region_name: str) -> str:
Expand Down
27 changes: 13 additions & 14 deletions moto/workspacesweb/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,23 @@ def associate_network_settings(self) -> str:
)

def create_user_settings(self) -> str:
params = self._get_params()
additional_encryption_context = params.get("additionalEncryptionContext")
client_token = params.get("clientToken")
cookie_synchronization_configuration = params.get(
additional_encryption_context = self._get_param("additionalEncryptionContext")
client_token = self._get_param("clientToken")
cookie_synchronization_configuration = self._get_param(
"cookieSynchronizationConfiguration"
)
copy_allowed = params.get("copyAllowed")
customer_managed_key = params.get("customerManagedKey")
deep_link_allowed = params.get("deepLinkAllowed")
disconnect_timeout_in_minutes = params.get("disconnectTimeoutInMinutes")
download_allowed = params.get("downloadAllowed")
idle_disconnect_timeout_in_minutes = params.get(
copy_allowed = self._get_param("copyAllowed")
customer_managed_key = self._get_param("customerManagedKey")
deep_link_allowed = self._get_param("deepLinkAllowed")
disconnect_timeout_in_minutes = self._get_param("disconnectTimeoutInMinutes")
download_allowed = self._get_param("downloadAllowed")
idle_disconnect_timeout_in_minutes = self._get_param(
"idleDisconnectTimeoutInMinutes"
)
paste_allowed = params.get("pasteAllowed")
print_allowed = params.get("printAllowed")
tags = params.get("tags")
upload_allowed = params.get("uploadAllowed")
paste_allowed = self._get_param("pasteAllowed")
print_allowed = self._get_param("printAllowed")
tags = self._get_param("tags")
upload_allowed = self._get_param("uploadAllowed")
user_settings_arn = self.workspacesweb_backend.create_user_settings(
additional_encryption_context=additional_encryption_context,
client_token=client_token,
Expand Down
12 changes: 6 additions & 6 deletions tests/test_workspacesweb/test_workspacesweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,20 @@ def test_create_user_settings():
def test_get_user_settings():
client = boto3.client("workspaces-web", region_name="eu-west-1")
resp = client.create_user_settings(
copyAllowed="Disabled",
copyAllowed="Enabled",
pasteAllowed="Disabled",
printAllowed="Disabled",
printAllowed="Enabled",
uploadAllowed="Disabled",
downloadAllowed="Disabled",
downloadAllowed="Enabled",
)
user_settings_arn = resp["userSettingsArn"]
resp = client.get_user_settings(userSettingsArn=user_settings_arn)["userSettings"]
assert resp["userSettingsArn"] == user_settings_arn
assert resp["copyAllowed"] == "Disabled"
assert resp["copyAllowed"] == "Enabled"
assert resp["pasteAllowed"] == "Disabled"
assert resp["printAllowed"] == "Disabled"
assert resp["printAllowed"] == "Enabled"
assert resp["uploadAllowed"] == "Disabled"
assert resp["downloadAllowed"] == "Disabled"
assert resp["downloadAllowed"] == "Enabled"


@mock_aws
Expand Down

0 comments on commit 21873d1

Please sign in to comment.