2022-07-05 21:35:32 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
2022-07-07 21:31:58 +00:00
|
|
|
import neofs_verbs
|
2022-07-05 21:35:32 +00:00
|
|
|
from neo3 import wallet
|
|
|
|
from robot.api.deco import keyword
|
|
|
|
from robot.libraries.BuiltIn import BuiltIn
|
|
|
|
|
|
|
|
ROBOT_AUTO_KEYWORDS = False
|
|
|
|
|
|
|
|
|
|
|
|
@keyword('Verify Head Tombstone')
|
2022-08-25 10:57:55 +00:00
|
|
|
def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str):
|
|
|
|
header = neofs_verbs.head_object(wallet_path, cid, oid_ts)
|
2022-07-05 21:35:32 +00:00
|
|
|
header = header['header']
|
|
|
|
|
|
|
|
BuiltIn().should_be_equal(header["containerID"], cid,
|
|
|
|
msg="Tombstone Header CID is wrong")
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
BuiltIn().should_be_equal(header["ownerID"], addr,
|
|
|
|
msg="Tombstone Owner ID is wrong")
|
|
|
|
|
|
|
|
BuiltIn().should_be_equal(header["objectType"], 'TOMBSTONE',
|
|
|
|
msg="Header Type isn't Tombstone")
|
|
|
|
|
|
|
|
BuiltIn().should_be_equal(
|
2022-07-07 21:31:58 +00:00
|
|
|
header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
|
|
|
|
msg="Header Session Type isn't DELETE"
|
|
|
|
)
|
2022-07-05 21:35:32 +00:00
|
|
|
|
|
|
|
BuiltIn().should_be_equal(
|
2022-07-07 21:31:58 +00:00
|
|
|
header["sessionToken"]["body"]["object"]["address"]["containerID"],
|
|
|
|
cid,
|
|
|
|
msg="Header Session ID is wrong"
|
|
|
|
)
|
2022-07-05 21:35:32 +00:00
|
|
|
|
|
|
|
BuiltIn().should_be_equal(
|
2022-07-07 21:31:58 +00:00
|
|
|
header["sessionToken"]["body"]["object"]["address"]["objectID"],
|
|
|
|
oid,
|
|
|
|
msg="Header Session OID is wrong"
|
|
|
|
)
|