Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

5 changed files with 16 additions and 17 deletions

View file

@ -134,10 +134,9 @@ class HttpClient:
@classmethod
def _create_curl_request(cls, url: str, method: str, headers: httpx.Headers, data: str, files: dict) -> str:
excluded_headers = {"Accept-Encoding", "Connection", "User-Agent", "Content-Length"}
headers = " ".join(f"-H '{header.title()}: {value}'" for header, value in headers.items() if header.title() not in excluded_headers)
headers = " ".join(f'-H "{name.title()}: {value}"' for name, value in headers.items())
data = f" -d '{data}'" if data else ""
for name, path in files.items():
data += f' -F "{name}=@{path}"'

View file

@ -1227,7 +1227,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
return response
@ -1239,7 +1239,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
return response
@ -1264,7 +1264,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
return response
@ -1276,7 +1276,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
return response
@ -1288,7 +1288,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
return response
@ -1324,7 +1324,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
return response

View file

@ -1091,7 +1091,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
return response
@reporter.step("Lists all managed policies that are attached to the specified IAM user")
@ -1102,7 +1102,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
return response
@reporter.step("Lists all IAM users, groups, and roles that the specified managed policy is attached to")
@ -1127,7 +1127,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
return response
@reporter.step("Lists the IAM groups")
@ -1137,7 +1137,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
return response
@reporter.step("Lists the IAM groups that the specified IAM user belongs to")
@ -1148,7 +1148,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
return response
@reporter.step("Lists all the managed policies that are available in your AWS account")
@ -1180,7 +1180,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
return response
@reporter.step("Lists the IAM users")

View file

@ -193,7 +193,7 @@ class RemoteProcess:
)
if "No such file or directory" in terminal.stderr:
return None
elif terminal.return_code != 0:
elif terminal.stderr or terminal.return_code != 0:
raise AssertionError(f"cat process {file} was not successful: {terminal.stderr}")
return terminal.stdout

View file

@ -161,5 +161,5 @@ class ChunksOperations(interfaces.ChunksInterface):
def _parse_object_nodes(self, object_nodes: str) -> list[Chunk]:
parse_result = json.loads(object_nodes)
if parse_result.get("errors"):
raise RuntimeError(", ".join(parse_result["errors"]))
raise parse_result["errors"]
return [Chunk(**chunk) for chunk in parse_result["data_objects"]]