forked from TrueCloudLab/frostfs-testcases
[#184]: verbs joined to keywords
Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
parent
d696a8ee68
commit
e086d0d62b
8 changed files with 211 additions and 224 deletions
|
@ -1,20 +1,15 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import random
|
||||
import uuid
|
||||
import base58
|
||||
|
||||
from neo3 import wallet
|
||||
from common import (NEOFS_NETMAP, WALLET_PASS, NEOFS_ENDPOINT,
|
||||
NEOFS_NETMAP_DICT, ASSETS_DIR)
|
||||
from cli_helpers import _cmd_run
|
||||
import json_transformers
|
||||
from common import NEOFS_NETMAP_DICT
|
||||
import neofs_verbs
|
||||
from robot.api.deco import keyword
|
||||
from robot.api import logger
|
||||
from robot.libraries.BuiltIn import BuiltIn
|
||||
|
||||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
|
@ -30,52 +25,35 @@ def get_scripthash(wif: str):
|
|||
|
||||
|
||||
@keyword('Verify Head Tombstone')
|
||||
def verify_head_tombstone(wallet: str, cid: str, oid_ts: str, oid: str, addr: str):
|
||||
# TODO: replace with HEAD from neofs_verbs.py
|
||||
object_cmd = (
|
||||
f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} '
|
||||
f'--config {WALLET_PASS} object head --cid {cid} --oid {oid_ts} --json'
|
||||
)
|
||||
output = _cmd_run(object_cmd)
|
||||
full_headers = json.loads(output)
|
||||
logger.info(f"Output: {full_headers}")
|
||||
def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str):
|
||||
header = neofs_verbs.head_object(wallet_path, cid, oid_ts)
|
||||
header = header['header']
|
||||
|
||||
# Header verification
|
||||
header_cid = full_headers["header"]["containerID"]["value"]
|
||||
if json_transformers.json_reencode(header_cid) == cid:
|
||||
logger.info(f"Header CID is expected: {cid} ({header_cid} in the output)")
|
||||
else:
|
||||
raise Exception("Header CID is not expected.")
|
||||
BuiltIn().should_be_equal(header["containerID"], cid,
|
||||
msg="Tombstone Header CID is wrong")
|
||||
|
||||
header_owner = full_headers["header"]["ownerID"]["value"]
|
||||
if json_transformers.json_reencode(header_owner) == addr:
|
||||
logger.info(f"Header ownerID is expected: {addr} ({header_owner} in the output)")
|
||||
else:
|
||||
raise Exception("Header ownerID is not expected.")
|
||||
wlt_data = dict()
|
||||
with open(wallet_path, 'r') as fout:
|
||||
wlt_data = json.loads(fout.read())
|
||||
wlt = wallet.Wallet.from_json(wlt_data, password='')
|
||||
addr = wlt.accounts[0].address
|
||||
|
||||
header_type = full_headers["header"]["objectType"]
|
||||
if header_type == "TOMBSTONE":
|
||||
logger.info(f"Header Type is expected: {header_type}")
|
||||
else:
|
||||
raise Exception("Header Type is not expected.")
|
||||
BuiltIn().should_be_equal(header["ownerID"], addr,
|
||||
msg="Tombstone Owner ID is wrong")
|
||||
|
||||
header_session_type = full_headers["header"]["sessionToken"]["body"]["object"]["verb"]
|
||||
if header_session_type == "DELETE":
|
||||
logger.info(f"Header Session Type is expected: {header_session_type}")
|
||||
else:
|
||||
raise Exception("Header Session Type is not expected.")
|
||||
BuiltIn().should_be_equal(header["objectType"], 'TOMBSTONE',
|
||||
msg="Header Type isn't Tombstone")
|
||||
|
||||
header_session_cid = full_headers["header"]["sessionToken"]["body"]["object"]["address"]["containerID"]["value"]
|
||||
if json_transformers.json_reencode(header_session_cid) == cid:
|
||||
logger.info(f"Header ownerID is expected: {addr} ({header_session_cid} in the output)")
|
||||
else:
|
||||
raise Exception("Header Session CID is not expected.")
|
||||
BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
|
||||
msg="Header Session Type isn't DELETE")
|
||||
|
||||
header_session_oid = full_headers["header"]["sessionToken"]["body"]["object"]["address"]["objectID"]["value"]
|
||||
if json_transformers.json_reencode(header_session_oid) == oid:
|
||||
logger.info(f"Header Session OID (deleted object) is expected: {oid} ({header_session_oid} in the output)")
|
||||
else:
|
||||
raise Exception("Header Session OID (deleted object) is not expected.")
|
||||
BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["address"]["containerID"],
|
||||
cid,
|
||||
msg="Header Session ID is wrong")
|
||||
|
||||
BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["address"]["objectID"],
|
||||
oid,
|
||||
msg="Header Session OID is wrong")
|
||||
|
||||
|
||||
@keyword('Get control endpoint with wif')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue