forked from TrueCloudLab/frostfs-testlib
[#343] Extend testsuites for PATCH method
Signed-off-by: Kirill Sosnovskikh <k.sosnovskikh@yadro.com>
This commit is contained in:
parent
9e3380d519
commit
0a3de927a2
3 changed files with 28 additions and 4 deletions
|
@ -315,8 +315,9 @@ class FrostfsCliObject(CliCommand):
|
||||||
ttl: TTL value in request meta header (default 2)
|
ttl: TTL value in request meta header (default 2)
|
||||||
wallet: WIF (NEP-2) string or path to the wallet or binary key
|
wallet: WIF (NEP-2) string or path to the wallet or binary key
|
||||||
xhdr: Dict with request X-Headers
|
xhdr: Dict with request X-Headers
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(str): ID of patched Object
|
Command's result.
|
||||||
"""
|
"""
|
||||||
return self._execute(
|
return self._execute(
|
||||||
"object patch",
|
"object patch",
|
||||||
|
|
|
@ -21,12 +21,16 @@ class S3HttpClient:
|
||||||
self, s3gate_endpoint: str, access_key_id: str, secret_access_key: str, profile: str = "default", region: str = "us-east-1"
|
self, s3gate_endpoint: str, access_key_id: str, secret_access_key: str, profile: str = "default", region: str = "us-east-1"
|
||||||
) -> None:
|
) -> None:
|
||||||
self.http_client = HttpClient()
|
self.http_client = HttpClient()
|
||||||
self.s3gate_endpoint = s3gate_endpoint
|
|
||||||
self.credentials = Credentials(access_key_id, secret_access_key)
|
self.credentials = Credentials(access_key_id, secret_access_key)
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
self.region = region
|
self.region = region
|
||||||
self.service = "s3"
|
|
||||||
self.signature = SigV4Auth(self.credentials, self.service, self.region)
|
self.iam_endpoint: str = None
|
||||||
|
self.s3gate_endpoint: str = None
|
||||||
|
self.service: str = None
|
||||||
|
self.signature: SigV4Auth = None
|
||||||
|
|
||||||
|
self.set_endpoint(s3gate_endpoint)
|
||||||
|
|
||||||
def _to_s3_header(self, header: str) -> dict:
|
def _to_s3_header(self, header: str) -> dict:
|
||||||
replacement_map = {
|
replacement_map = {
|
||||||
|
@ -104,6 +108,24 @@ class S3HttpClient:
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@reporter.step("Set endpoint S3 to {s3gate_endpoint}")
|
||||||
|
def set_endpoint(self, s3gate_endpoint: str):
|
||||||
|
if self.s3gate_endpoint == s3gate_endpoint:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.s3gate_endpoint = s3gate_endpoint
|
||||||
|
self.service = "s3"
|
||||||
|
self.signature = SigV4Auth(self.credentials, self.service, self.region)
|
||||||
|
|
||||||
|
@reporter.step("Set endpoint IAM to {iam_endpoint}")
|
||||||
|
def set_iam_endpoint(self, iam_endpoint: str):
|
||||||
|
if self.iam_endpoint == iam_endpoint:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.iam_endpoint = iam_endpoint
|
||||||
|
self.service = "iam"
|
||||||
|
self.signature = SigV4Auth(self.credentials, self.service, self.region)
|
||||||
|
|
||||||
@reporter.step("Patch object S3")
|
@reporter.step("Patch object S3")
|
||||||
def patch_object(
|
def patch_object(
|
||||||
self,
|
self,
|
||||||
|
|
|
@ -52,6 +52,7 @@ class Operations:
|
||||||
SEARCH_OBJECT = "SearchObject"
|
SEARCH_OBJECT = "SearchObject"
|
||||||
HEAD_OBJECT = "HeadObject"
|
HEAD_OBJECT = "HeadObject"
|
||||||
PUT_OBJECT = "PutObject"
|
PUT_OBJECT = "PutObject"
|
||||||
|
PATCH_OBJECT = "PatchObject"
|
||||||
|
|
||||||
|
|
||||||
class Verb(HumanReadableEnum):
|
class Verb(HumanReadableEnum):
|
||||||
|
|
Loading…
Reference in a new issue