[] finally got rid of neofs.py

Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
anastasia prasolova 2022-07-06 00:35:32 +03:00 committed by Anastasia Prasolova
parent d396118085
commit 7abb2761c9
17 changed files with 102 additions and 113 deletions

View file

@ -1,86 +0,0 @@
#!/usr/bin/python3
import json
import os
import random
from neo3 import wallet
from robot.api import logger
from robot.api.deco import keyword
from robot.libraries.BuiltIn import BuiltIn
import neofs_verbs
from common import NEOFS_NETMAP_DICT
ROBOT_AUTO_KEYWORDS = False
# path to neofs-cli executable
NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli')
@keyword('Verify Head Tombstone')
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']
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(header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
msg="Header Session Type isn't DELETE")
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 and wallet')
def get_control_endpoint_and_wallet(endpoint_number: str = ''):
"""
Gets control endpoint for a random or given node
Args:
endpoint_number (optional, str): the number of the node
in the form of 's01', 's02', etc.
given in NEOFS_NETMAP_DICT as keys
Returns:
(str): the number of the node
(str): endpoint control for the node
(str): the wallet of the respective node
"""
if endpoint_number == '':
endpoint_num = random.choice(list(NEOFS_NETMAP_DICT.keys()))
logger.info(f'Random node chosen: {endpoint_num}')
else:
endpoint_num = endpoint_number
endpoint_values = NEOFS_NETMAP_DICT[f'{endpoint_num}']
endpoint_control = endpoint_values['control']
wlt = endpoint_values['wallet_path']
return endpoint_num, endpoint_control, wlt
@keyword('Get Locode')
def get_locode():
endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values()))
locode = endpoint_values['UN-LOCODE']
logger.info(f'Random locode chosen: {locode}')
return locode

View file

@ -8,6 +8,8 @@
import random import random
import docker import docker
from common import NEOFS_NETMAP_DICT
from robot.api import logger
from robot.api.deco import keyword from robot.api.deco import keyword
ROBOT_AUTO_KEYWORDS = False ROBOT_AUTO_KEYWORDS = False
@ -45,3 +47,39 @@ def start_nodes(nodes: list):
for node in nodes: for node in nodes:
node = node.split('.')[0] node = node.split('.')[0]
client.start(node) client.start(node)
@keyword('Get control endpoint and wallet')
def get_control_endpoint_and_wallet(endpoint_number: str = ''):
"""
Gets control endpoint for a random or given node
Args:
endpoint_number (optional, str): the number of the node
in the form of 's01', 's02', etc.
given in NEOFS_NETMAP_DICT as keys
Returns:
(str): the number of the node
(str): endpoint control for the node
(str): the wallet of the respective node
"""
if endpoint_number == '':
endpoint_num = random.choice(list(NEOFS_NETMAP_DICT.keys()))
logger.info(f'Random node chosen: {endpoint_num}')
else:
endpoint_num = endpoint_number
endpoint_values = NEOFS_NETMAP_DICT[f'{endpoint_num}']
endpoint_control = endpoint_values['control']
wlt = endpoint_values['wallet_path']
return endpoint_num, endpoint_control, wlt
@keyword('Get Locode')
def get_locode():
endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values()))
locode = endpoint_values['UN-LOCODE']
logger.info(f'Random locode chosen: {locode}')
return locode

View file

@ -0,0 +1,49 @@
#!/usr/bin/python3
import json
from neo3 import wallet
from robot.api.deco import keyword
from robot.libraries.BuiltIn import BuiltIn
import neofs_verbs
ROBOT_AUTO_KEYWORDS = False
@keyword('Verify Head Tombstone')
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']
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(
header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
msg="Header Session Type isn't DELETE"
)
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"
)

View file

@ -4,7 +4,6 @@ Variables eacl_object_filters.py
Library acl.py Library acl.py
Library container.py Library container.py
Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library Collections Library Collections

View file

@ -2,7 +2,7 @@
Variables common.py Variables common.py
Library epoch.py Library epoch.py
Library neofs.py Library tombstone.py
Library neofs_verbs.py Library neofs_verbs.py
Library utility_keywords.py Library utility_keywords.py
Library Collections Library Collections

View file

@ -4,7 +4,7 @@ Variables common.py
Library acl.py Library acl.py
Library container.py Library container.py
Library epoch.py Library epoch.py
Library neofs.py Library nodes_management.py
Library neofs_verbs.py Library neofs_verbs.py
Library storage_policy.py Library storage_policy.py
Library utility_keywords.py Library utility_keywords.py

View file

@ -3,7 +3,6 @@ Variables common.py
Library acl.py Library acl.py
Library container.py Library container.py
Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library Collections Library Collections

View file

@ -4,7 +4,6 @@ Variables common.py
Library Collections Library Collections
Library acl.py Library acl.py
Library container.py Library container.py
Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library utility_keywords.py Library utility_keywords.py

View file

@ -2,8 +2,6 @@
Variables common.py Variables common.py
Library container.py Library container.py
Library neofs.py
Library payment_neogo.py
Library String Library String
Library Collections Library Collections

View file

@ -3,7 +3,7 @@ Variables common.py
Library Process Library Process
Library epoch.py Library epoch.py
Library neofs.py Library nodes_management.py
Library String Library String
Library acl.py Library acl.py
@ -13,7 +13,6 @@ Resource payment_operations.robot
*** Test Cases *** *** Test Cases ***
Control Operations with storage nodes Control Operations with storage nodes
[Documentation] Testcase to check NetworkInfo control command. [Documentation] Testcase to check NetworkInfo control command.
[Tags] NeoFSCLI NetworkInfo
[Timeout] 5 min [Timeout] 5 min
[Setup] Setup [Setup] Setup

View file

@ -3,7 +3,7 @@ Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library container.py Library container.py
Library neofs.py Library nodes_management.py
Library neofs_verbs.py Library neofs_verbs.py
Library utility_keywords.py Library utility_keywords.py

View file

@ -5,7 +5,6 @@ Variables common.py
Library container.py Library container.py
Library complex_object_actions.py Library complex_object_actions.py
Library neofs_verbs.py Library neofs_verbs.py
Library neofs.py
Library storage_policy.py Library storage_policy.py
Library utility_keywords.py Library utility_keywords.py

View file

@ -1,7 +1,6 @@
*** Settings *** *** Settings ***
Variables common.py Variables common.py
Library neofs.py
Library container.py Library container.py
Library neofs_verbs.py Library neofs_verbs.py
Library storage_group.py Library storage_group.py

View file

@ -1,7 +1,6 @@
*** Settings *** *** Settings ***
Variables common.py Variables common.py
Library neofs.py
Library payment_neogo.py Library payment_neogo.py
Library utility_keywords.py Library utility_keywords.py

View file

@ -3,7 +3,6 @@ Variables common.py
Variables wellknown_acl.py Variables wellknown_acl.py
Library container.py Library container.py
Library neofs.py
Library neofs_verbs.py Library neofs_verbs.py
Library http_gate.py Library http_gate.py
Library storage_policy.py Library storage_policy.py

View file

@ -4,7 +4,6 @@ Variables common.py
Library Collections Library Collections
Library OperatingSystem Library OperatingSystem
Library neofs.py
Library container.py Library container.py
Library s3_gate.py Library s3_gate.py
Library epoch.py Library epoch.py

View file

@ -5,7 +5,6 @@ Library Collections
Library OperatingSystem Library OperatingSystem
Library container.py Library container.py
Library neofs.py
Library s3_gate.py Library s3_gate.py
Library utility_keywords.py Library utility_keywords.py