[#3] Move source code of testlib to src directory

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-09-23 10:12:04 +04:00 committed by Vladimir
parent c48f7b7ff2
commit f5cd6a1954
41 changed files with 230 additions and 207 deletions

View file

@ -48,3 +48,34 @@ SSH_SHELL_LOGIN = <login that has permissions to run python3 on the server>
SSH_SHELL_PRIVATE_KEY_PATH = <path to SSH private key on your machine> SSH_SHELL_PRIVATE_KEY_PATH = <path to SSH private key on your machine>
SSH_SHELL_PRIVATE_KEY_PASSPHRASE = <passphrase for the SSH private key> SSH_SHELL_PRIVATE_KEY_PASSPHRASE = <passphrase for the SSH private key>
``` ```
### Editable installation
If you would like to modify code of the library in the integration with your test suite, you can use editable installation. For that, in virtual environment of your test suite (not in the virtual environment of the testlib itself!) run the following command (path to `neofs-testlib` directory might be different on your machine):
```shell
$ pip install -e ../neofs-testlib
```
### Building and publishing package
To build Python package of the library, please run the following command in the library root directory:
```shell
$ python -m build
```
This command will put wheel file and source archive under `dist` directory.
To check that package description will be correctly rendered at PyPI, please, use command:
```shell
$ twine check dist/*
```
To upload package to [test PyPI](https://test.pypi.org/project/neofs-testlib/), please, use command:
```shell
$ twine upload -r testpypi dist/*
```
It will prompt for your username and password. You would need to [create test PyPI account](https://test.pypi.org/account/register/) in order to execute it.
To upload package to actual PyPI, please, use command:
```shell
$ twine upload dist/*
```
It will prompt for your username and password. You would need to [create account](https://pypi.org/account/register/) in order to execute it.

View file

@ -1,3 +0,0 @@
from .adm import NeofsAdm
from .authmate import NeofsAuthmate
from .go import NeoGo, NetworkType

View file

@ -1 +0,0 @@
from .adm import NeofsAdm

View file

@ -1 +0,0 @@
from .authmate import NeofsAuthmate

View file

@ -1,2 +0,0 @@
from .blockchain_network_type import NetworkType
from .go import NeoGo

View file

@ -1,3 +0,0 @@
from .interfaces import CommandResult, Shell
from .local_shell import LocalShell
from .ssh_shell import SSHShell

View file

@ -0,0 +1,3 @@
from neofs_testlib.cli.neofs_adm.adm import NeofsAdm
from neofs_testlib.cli.neofs_authmate.authmate import NeofsAuthmate
from neofs_testlib.cli.neogo.go import NeoGo

View file

@ -1,13 +1,13 @@
from typing import Optional from typing import Optional
from shell import CommandResult, Shell from neofs_testlib.shell import CommandResult, Shell
class NeofsCliCommand: class CliCommand:
WALLET_SOURCE_ERROR_MSG = 'Provide either wallet or wallet_config to specify wallet location' WALLET_SOURCE_ERROR_MSG = "Provide either wallet or wallet_config to specify wallet location"
neofs_cli_exec: Optional[str] = None cli_exec_path: Optional[str] = None
__base_params: Optional[str] = None __base_params: Optional[str] = None
map_params = { map_params = {
"json_mode": "json", "json_mode": "json",
@ -16,9 +16,9 @@ class NeofsCliCommand:
"doc_type": "type", "doc_type": "type",
} }
def __init__(self, shell: Shell, neofs_cli_exec: str, **base_params): def __init__(self, shell: Shell, cli_exec_path: str, **base_params):
self.shell = shell self.shell = shell
self.neofs_cli_exec = neofs_cli_exec self.cli_exec_path = cli_exec_path
self.__base_params = " ".join( self.__base_params = " ".join(
[f"--{param} {value}" for param, value in base_params.items() if value] [f"--{param} {value}" for param, value in base_params.items() if value]
) )
@ -52,7 +52,7 @@ class NeofsCliCommand:
param_str = " ".join(param_str) param_str = " ".join(param_str)
return f'{self.neofs_cli_exec} {self.__base_params} {command or ""} {param_str}' return f"{self.cli_exec_path} {self.__base_params} {command or ''} {param_str}"
def _execute(self, command: Optional[str], **params) -> CommandResult: def _execute(self, command: Optional[str], **params) -> CommandResult:
return self.shell.exec(self._format_command(command, **params)) return self.shell.exec(self._format_command(command, **params))

View file

@ -0,0 +1 @@
from neofs_testlib.cli.neofs_adm.adm import NeofsAdm

View file

@ -1,16 +1,14 @@
from typing import Optional from typing import Optional
from shell import Shell from neofs_testlib.cli.neofs_adm.config import NeofsAdmConfig
from neofs_testlib.cli.neofs_adm.morph import NeofsAdmMorph
from .config import NeofsAdmConfig from neofs_testlib.cli.neofs_adm.storage_config import NeofsAdmStorageConfig
from .morph import NeofsAdmMorph from neofs_testlib.cli.neofs_adm.subnet import NeofsAdmMorphSubnet
from .subnet import NeofsAdmMorphSubnet from neofs_testlib.cli.neofs_adm.version import NeofsAdmVersion
from .storage_config import NeofsAdmStorageConfig from neofs_testlib.shell import Shell
from .version import NeofsAdmVersion
class NeofsAdm: class NeofsAdm:
config: Optional[NeofsAdmConfig] = None
morph: Optional[NeofsAdmMorph] = None morph: Optional[NeofsAdmMorph] = None
subnet: Optional[NeofsAdmMorphSubnet] = None subnet: Optional[NeofsAdmMorphSubnet] = None
storage_config: Optional[NeofsAdmStorageConfig] = None storage_config: Optional[NeofsAdmStorageConfig] = None

View file

@ -1,8 +1,8 @@
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeofsAdmConfig(NeofsCliCommand): class NeofsAdmConfig(CliCommand):
def init(self, path: str = "~/.neofs/adm/config.yml") -> CommandResult: def init(self, path: str = "~/.neofs/adm/config.yml") -> CommandResult:
"""Initialize basic neofs-adm configuration file. """Initialize basic neofs-adm configuration file.
@ -20,5 +20,5 @@ class NeofsAdmConfig(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,10 +1,10 @@
from typing import Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeofsAdmMorph(NeofsCliCommand): class NeofsAdmMorph(CliCommand):
def deposit_notary( def deposit_notary(
self, self,
rpc_endpoint: str, rpc_endpoint: str,
@ -92,7 +92,7 @@ class NeofsAdmMorph(NeofsCliCommand):
rpc_endpoint: str, rpc_endpoint: str,
cid: Optional[str] = None, cid: Optional[str] = None,
container_contract: Optional[str] = None, container_contract: Optional[str] = None,
dump: str = './testlib_dump_container', dump: str = "./testlib_dump_container",
) -> CommandResult: ) -> CommandResult:
"""Dump NeoFS containers to file. """Dump NeoFS containers to file.
@ -160,7 +160,12 @@ class NeofsAdmMorph(NeofsCliCommand):
}, },
) )
def generate_alphabet(self, rpc_endpoint: str, alphabet_wallets: str, size: int = 7) -> CommandResult: def generate_alphabet(
self,
rpc_endpoint: str,
alphabet_wallets: str,
size: int = 7,
) -> CommandResult:
"""Generate alphabet wallets for consensus nodes of the morph network """Generate alphabet wallets for consensus nodes of the morph network
Args: Args:
@ -284,7 +289,11 @@ class NeofsAdmMorph(NeofsCliCommand):
) )
def restore_containers( def restore_containers(
self, rpc_endpoint: str, alphabet_wallets: str, cid: str, dump: str self,
rpc_endpoint: str,
alphabet_wallets: str,
cid: str,
dump: str,
) -> CommandResult: ) -> CommandResult:
"""Restore NeoFS containers from file. """Restore NeoFS containers from file.
@ -347,7 +356,10 @@ class NeofsAdmMorph(NeofsCliCommand):
) )
def update_contracts( def update_contracts(
self, rpc_endpoint: str, alphabet_wallets: str, contracts: Optional[str] = None self,
rpc_endpoint: str,
alphabet_wallets: str,
contracts: Optional[str] = None,
) -> CommandResult: ) -> CommandResult:
"""Update NeoFS contracts. """Update NeoFS contracts.

View file

@ -1,8 +1,8 @@
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeofsAdmStorageConfig(NeofsCliCommand): class NeofsAdmStorageConfig(CliCommand):
def set(self, account: str, wallet: str) -> CommandResult: def set(self, account: str, wallet: str) -> CommandResult:
"""Initialize basic neofs-adm configuration file. """Initialize basic neofs-adm configuration file.
@ -21,5 +21,5 @@ class NeofsAdmStorageConfig(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,11 +1,13 @@
from typing import Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeofsAdmMorphSubnet(NeofsCliCommand): class NeofsAdmMorphSubnet(CliCommand):
def create(self, rpc_endpoint: str, address: str, wallet: str, notary: bool = False) -> CommandResult: def create(
self, rpc_endpoint: str, address: str, wallet: str, notary: bool = False
) -> CommandResult:
"""Create NeoFS subnet. """Create NeoFS subnet.
Args: Args:
@ -25,7 +27,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def get(self, rpc_endpoint: str, subnet: str) -> CommandResult: def get(self, rpc_endpoint: str, subnet: str) -> CommandResult:
@ -46,7 +48,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def remove( def remove(
@ -71,7 +73,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def admin_add( def admin_add(
@ -106,7 +108,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def admin_remove( def admin_remove(
@ -139,7 +141,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def client_add( def client_add(
@ -172,7 +174,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def client_remove( def client_remove(
@ -205,7 +207,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def node_add(self, rpc_endpoint: str, wallet: str, node: str, subnet: str) -> CommandResult: def node_add(self, rpc_endpoint: str, wallet: str, node: str, subnet: str) -> CommandResult:
@ -228,7 +230,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def node_remove(self, rpc_endpoint: str, wallet: str, node: str, subnet: str) -> CommandResult: def node_remove(self, rpc_endpoint: str, wallet: str, node: str, subnet: str) -> CommandResult:
@ -251,5 +253,5 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,8 +1,8 @@
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeofsAuthmateVersion(NeofsCliCommand): class NeofsAdmVersion(CliCommand):
def get(self) -> CommandResult: def get(self) -> CommandResult:
"""Application version """Application version

View file

@ -0,0 +1 @@
from neofs_testlib.cli.neofs_authmate.authmate import NeofsAuthmate

View file

@ -1,20 +1,14 @@
from typing import Optional from typing import Optional
from shell import Shell from neofs_testlib.cli.neofs_authmate.secret import NeofsAuthmateSecret
from neofs_testlib.cli.neofs_authmate.version import NeofsAuthmateVersion
from .secret import NeofsAuthmateSecret from neofs_testlib.shell import Shell
from .version import NeofsAuthmateVersion
class NeofsAuthmate: class NeofsAuthmate:
secret: Optional[NeofsAuthmateSecret] = None secret: Optional[NeofsAuthmateSecret] = None
version: Optional[NeofsAuthmateVersion] = None version: Optional[NeofsAuthmateVersion] = None
def __init__( def __init__(self, shell: Shell, neofs_authmate_exec_path: str):
self,
shell: Shell,
neofs_authmate_exec_path: str,
):
self.secret = NeofsAuthmateSecret(shell, neofs_authmate_exec_path) self.secret = NeofsAuthmateSecret(shell, neofs_authmate_exec_path)
self.version = NeofsAuthmateVersion(shell, neofs_authmate_exec_path) self.version = NeofsAuthmateVersion(shell, neofs_authmate_exec_path)

View file

@ -1,10 +1,10 @@
from typing import Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeofsAuthmateSecret(NeofsCliCommand): class NeofsAuthmateSecret(CliCommand):
def obtain( def obtain(
self, self,
wallet: str, wallet: str,
@ -34,7 +34,7 @@ class NeofsAuthmateSecret(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def issue( def issue(
@ -88,5 +88,5 @@ class NeofsAuthmateSecret(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,8 +1,8 @@
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeofsAdmVersion(NeofsCliCommand): class NeofsAuthmateVersion(CliCommand):
def get(self) -> CommandResult: def get(self) -> CommandResult:
"""Application version """Application version

View file

@ -0,0 +1,2 @@
from neofs_testlib.cli.neogo.go import NeoGo
from neofs_testlib.cli.neogo.network_type import NetworkType

View file

@ -1,11 +1,10 @@
from typing import Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeoGoCandidate(NeofsCliCommand): class NeoGoCandidate(CliCommand):
def register( def register(
self, self,
address: str, address: str,
@ -15,7 +14,7 @@ class NeoGoCandidate(NeofsCliCommand):
gas: Optional[float] = None, gas: Optional[float] = None,
timeout: int = 10, timeout: int = 10,
) -> CommandResult: ) -> CommandResult:
""" register as a new candidate """Register as a new candidate
Args: Args:
address (str): Address to register address (str): Address to register
@ -40,7 +39,7 @@ class NeoGoCandidate(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def unregister( def unregister(
@ -52,7 +51,7 @@ class NeoGoCandidate(NeofsCliCommand):
gas: Optional[float] = None, gas: Optional[float] = None,
timeout: int = 10, timeout: int = 10,
) -> CommandResult: ) -> CommandResult:
""" unregister self as a candidate """Unregister self as a candidate
Args: Args:
address (str): Address to unregister address (str): Address to unregister
@ -77,7 +76,7 @@ class NeoGoCandidate(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def vote( def vote(
@ -103,7 +102,6 @@ class NeoGoCandidate(NeofsCliCommand):
rpc_endpoint (str): RPC node address rpc_endpoint (str): RPC node address
timeout (int): Timeout for the operation (default: 10s) timeout (int): Timeout for the operation (default: 10s)
Returns: Returns:
str: Command string str: Command string
@ -116,5 +114,5 @@ class NeoGoCandidate(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,10 +1,10 @@
from typing import Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeoGoContract(NeofsCliCommand): class NeoGoContract(CliCommand):
def compile( def compile(
self, self,
input_file: str, input_file: str,
@ -16,7 +16,7 @@ class NeoGoContract(NeofsCliCommand):
no_permissions: bool = False, no_permissions: bool = False,
bindings: Optional[str] = None, bindings: Optional[str] = None,
) -> CommandResult: ) -> CommandResult:
"""compile a smart contract to a .nef file """Compile a smart contract to a .nef file
Args: Args:
input_file (str): Input file for the smart contract to be compiled input_file (str): Input file for the smart contract to be compiled
@ -55,9 +55,8 @@ class NeoGoContract(NeofsCliCommand):
out: Optional[str] = None, out: Optional[str] = None,
force: bool = False, force: bool = False,
timeout: int = 10, timeout: int = 10,
) -> CommandResult: ) -> CommandResult:
"""deploy a smart contract (.nef with description) """Deploy a smart contract (.nef with description)
Args: Args:
wallet (str): wallet to use to get the key for transaction signing; wallet (str): wallet to use to get the key for transaction signing;
@ -97,7 +96,7 @@ class NeoGoContract(NeofsCliCommand):
config: Optional[str] = None, config: Optional[str] = None,
manifest: Optional[str] = None, manifest: Optional[str] = None,
) -> CommandResult: ) -> CommandResult:
"""generate wrapper to use in other contracts """Generate wrapper to use in other contracts
Args: Args:
config (str): Configuration file to use config (str): Configuration file to use
@ -253,7 +252,7 @@ class NeoGoContract(NeofsCliCommand):
name: str, name: str,
skip_details: bool = False, skip_details: bool = False,
) -> CommandResult: ) -> CommandResult:
"""initialize a new smart-contract in a directory with boiler plate code """Initialize a new smart-contract in a directory with boiler plate code
Args: Args:
name (str): name of the smart-contract to be initialized name (str): name of the smart-contract to be initialized
@ -277,7 +276,7 @@ class NeoGoContract(NeofsCliCommand):
input_file: Optional[str] = None, input_file: Optional[str] = None,
compile: Optional[str] = None, compile: Optional[str] = None,
) -> CommandResult: ) -> CommandResult:
"""creates a user readable dump of the program instructions """Creates a user readable dump of the program instructions
Args: Args:
input_file (str): input file of the program (either .go or .nef) input_file (str): input file of the program (either .go or .nef)
@ -302,7 +301,7 @@ class NeoGoContract(NeofsCliCommand):
manifest: str, manifest: str,
sender: Optional[str] = None, sender: Optional[str] = None,
) -> CommandResult: ) -> CommandResult:
"""calculates hash of a contract after deployment """Calculates hash of a contract after deployment
Args: Args:
input_file (str): path to NEF file input_file (str): path to NEF file
@ -331,7 +330,7 @@ class NeoGoContract(NeofsCliCommand):
sender: Optional[str] = None, sender: Optional[str] = None,
nef: Optional[str] = None, nef: Optional[str] = None,
) -> CommandResult: ) -> CommandResult:
"""adds group to the manifest """Adds group to the manifest
Args: Args:
wallet (str): wallet to use to get the key for transaction signing; wallet (str): wallet to use to get the key for transaction signing;

View file

@ -1,12 +1,11 @@
from typing import Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.cli.neogo.network_type import NetworkType
from neofs_testlib.shell import CommandResult
from .blockchain_network_type import NetworkType
class NeoGoDb(NeofsCliCommand): class NeoGoDb(CliCommand):
def dump( def dump(
self, self,
config_path: str, config_path: str,
@ -15,7 +14,7 @@ class NeoGoDb(NeofsCliCommand):
count: int = 0, count: int = 0,
start: int = 0, start: int = 0,
) -> CommandResult: ) -> CommandResult:
""" dump blocks (starting with block #1) to the file """Dump blocks (starting with block #1) to the file
Args: Args:
config_path (str): path to config config_path (str): path to config
@ -36,7 +35,7 @@ class NeoGoDb(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def restore( def restore(
@ -48,7 +47,7 @@ class NeoGoDb(NeofsCliCommand):
dump: Optional[str] = None, dump: Optional[str] = None,
incremental: bool = False, incremental: bool = False,
) -> CommandResult: ) -> CommandResult:
""" dump blocks (starting with block #1) to the file """Dump blocks (starting with block #1) to the file
Args: Args:
config_path (str): path to config config_path (str): path to config
@ -70,5 +69,5 @@ class NeoGoDb(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,20 +1,17 @@
from typing import Optional from typing import Optional
from shell import Shell from neofs_testlib.cli.neogo.candidate import NeoGoCandidate
from neofs_testlib.cli.neogo.contract import NeoGoContract
from .candidate import NeoGoCandidate from neofs_testlib.cli.neogo.db import NeoGoDb
from .contract import NeoGoContract from neofs_testlib.cli.neogo.nep17 import NeoGoNep17
from .db import NeoGoDb from neofs_testlib.cli.neogo.node import NeoGoNode
from .nep17 import NeoGoNep17 from neofs_testlib.cli.neogo.query import NeoGoQuery
from .node import NeoGoNode from neofs_testlib.cli.neogo.version import NeoGoVersion
from .query import NeoGoQuery from neofs_testlib.cli.neogo.wallet import NeoGoWallet
from .version import NeoGoVersion from neofs_testlib.shell import Shell
from .wallet import NeoGoWallet
class NeoGo: class NeoGo:
neo_go_exec_path: Optional[str] = None
config_path: Optional[str] = None
candidate: Optional[NeoGoCandidate] = None candidate: Optional[NeoGoCandidate] = None
contract: Optional[NeoGoContract] = None contract: Optional[NeoGoContract] = None
db: Optional[NeoGoDb] = None db: Optional[NeoGoDb] = None
@ -30,12 +27,8 @@ class NeoGo:
neo_go_exec_path: Optional[str] = None, neo_go_exec_path: Optional[str] = None,
config_path: Optional[str] = None, config_path: Optional[str] = None,
): ):
self.candidate = NeoGoCandidate( self.candidate = NeoGoCandidate(shell, neo_go_exec_path, config_path=config_path)
shell, neo_go_exec_path, config_path=config_path self.contract = NeoGoContract(shell, neo_go_exec_path, config_path=config_path)
)
self.contract = NeoGoContract(
self.neo_go_exec_path, config_path=config_path
)
self.db = NeoGoDb(shell, neo_go_exec_path, config_path=config_path) self.db = NeoGoDb(shell, neo_go_exec_path, config_path=config_path)
self.nep17 = NeoGoNep17(shell, neo_go_exec_path, config_path=config_path) self.nep17 = NeoGoNep17(shell, neo_go_exec_path, config_path=config_path)
self.node = NeoGoNode(shell, neo_go_exec_path, config_path=config_path) self.node = NeoGoNode(shell, neo_go_exec_path, config_path=config_path)

View file

@ -1,10 +1,10 @@
from typing import List, Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeoGoNep17(NeofsCliCommand): class NeoGoNep17(CliCommand):
def balance( def balance(
self, self,
address: str, address: str,
@ -38,7 +38,7 @@ class NeoGoNep17(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def import_token( def import_token(
@ -74,7 +74,7 @@ class NeoGoNep17(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def info( def info(
@ -104,7 +104,7 @@ class NeoGoNep17(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def remove( def remove(
@ -134,7 +134,7 @@ class NeoGoNep17(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def transfer( def transfer(
@ -188,13 +188,13 @@ class NeoGoNep17(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def multitransfer( def multitransfer(
self, self,
token: str, token: str,
to_address: List[str], to_address: list[str],
sysgas: float, sysgas: float,
rpc_endpoint: str, rpc_endpoint: str,
wallet: Optional[str] = None, wallet: Optional[str] = None,
@ -204,7 +204,6 @@ class NeoGoNep17(NeofsCliCommand):
force: bool = False, force: bool = False,
gas: Optional[float] = None, gas: Optional[float] = None,
amount: float = 0, amount: float = 0,
timeout: int = 10, timeout: int = 10,
) -> CommandResult: ) -> CommandResult:
"""transfer NEP-17 tokens to multiple recipients """transfer NEP-17 tokens to multiple recipients
@ -239,5 +238,5 @@ class NeoGoNep17(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,10 +1,9 @@
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.cli.neogo.network_type import NetworkType
from neofs_testlib.shell import CommandResult
from .blockchain_network_type import NetworkType
class NeoGoNode(NeofsCliCommand): class NeoGoNode(CliCommand):
def start(self, network: NetworkType = NetworkType.PRIVATE) -> CommandResult: def start(self, network: NetworkType = NetworkType.PRIVATE) -> CommandResult:
"""Start a NEO node """Start a NEO node

View file

@ -1,10 +1,8 @@
from typing import Optional from neofs_testlib.cli.cli_command import CliCommand
from neofs_testlib.shell import CommandResult
from cli.cli_command import NeofsCliCommand
from shell import CommandResult
class NeoGoQuery(NeofsCliCommand): class NeoGoQuery(CliCommand):
def candidates( def candidates(
self, self,
rpc_endpoint: str, rpc_endpoint: str,

View file

@ -1,8 +1,8 @@
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeoGoVersion(NeofsCliCommand): class NeoGoVersion(CliCommand):
def get(self) -> CommandResult: def get(self) -> CommandResult:
"""Application version """Application version

View file

@ -1,10 +1,10 @@
from typing import Optional from typing import Optional
from cli.cli_command import NeofsCliCommand from neofs_testlib.cli.cli_command import CliCommand
from shell import CommandResult from neofs_testlib.shell import CommandResult
class NeoGoWallet(NeofsCliCommand): class NeoGoWallet(CliCommand):
def claim( def claim(
self, self,
address: str, address: str,
@ -36,7 +36,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def init( def init(
@ -66,7 +66,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def convert( def convert(
@ -96,7 +96,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def create( def create(
@ -124,7 +124,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def dump( def dump(
@ -154,7 +154,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def dump_keys( def dump_keys(
@ -184,7 +184,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def export( def export(
@ -214,7 +214,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def import_wif( def import_wif(
@ -248,7 +248,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def import_multisig( def import_multisig(
@ -282,7 +282,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def import_deployed( def import_deployed(
@ -293,7 +293,6 @@ class NeoGoWallet(NeofsCliCommand):
wallet: Optional[str] = None, wallet: Optional[str] = None,
wallet_config: Optional[str] = None, wallet_config: Optional[str] = None,
contract: Optional[str] = None, contract: Optional[str] = None,
timeout: int = 10, timeout: int = 10,
) -> CommandResult: ) -> CommandResult:
"""import multisig contract """import multisig contract
@ -321,7 +320,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def remove( def remove(
@ -353,7 +352,7 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )
def sign( def sign(
@ -391,5 +390,5 @@ class NeoGoWallet(NeofsCliCommand):
param: param_value param: param_value
for param, param_value in locals().items() for param, param_value in locals().items()
if param not in ["self"] if param not in ["self"]
} },
) )

View file

@ -1,8 +1,8 @@
import os import os
from reporter.allure_reporter import AllureReporter from neofs_testlib.reporter.allure_reporter import AllureReporter
from reporter.dummy_reporter import DummyReporter from neofs_testlib.reporter.dummy_reporter import DummyReporter
from reporter.interfaces import Reporter from neofs_testlib.reporter.interfaces import Reporter
def get_reporter() -> Reporter: def get_reporter() -> Reporter:

View file

@ -6,7 +6,7 @@ from typing import Any
import allure import allure
from allure import attachment_type from allure import attachment_type
from reporter.interfaces import Reporter from neofs_testlib.reporter.interfaces import Reporter
class AllureReporter(Reporter): class AllureReporter(Reporter):

View file

@ -1,7 +1,7 @@
from contextlib import AbstractContextManager, contextmanager from contextlib import AbstractContextManager, contextmanager
from typing import Any from typing import Any
from reporter.interfaces import Reporter from neofs_testlib.reporter.interfaces import Reporter
@contextmanager @contextmanager

View file

@ -0,0 +1,3 @@
from neofs_testlib.shell.interfaces import CommandResult, Shell
from neofs_testlib.shell.local_shell import LocalShell
from neofs_testlib.shell.ssh_shell import SSHShell

View file

@ -6,8 +6,8 @@ from typing import IO, Optional
import pexpect import pexpect
from reporter import get_reporter from neofs_testlib.reporter import get_reporter
from shell.interfaces import CommandOptions, CommandResult, Shell from neofs_testlib.shell.interfaces import CommandOptions, CommandResult, Shell
logger = logging.getLogger("neofs.testlib.shell") logger = logging.getLogger("neofs.testlib.shell")
reporter = get_reporter() reporter = get_reporter()

View file

@ -18,8 +18,8 @@ from paramiko import (
) )
from paramiko.ssh_exception import AuthenticationException from paramiko.ssh_exception import AuthenticationException
from reporter import get_reporter from neofs_testlib.reporter import get_reporter
from shell.interfaces import CommandOptions, CommandResult, Shell from neofs_testlib.shell.interfaces import CommandOptions, CommandResult, Shell
logger = logging.getLogger("neofs.testlib.shell") logger = logging.getLogger("neofs.testlib.shell")
reporter = get_reporter() reporter = get_reporter()

View file

@ -1,6 +1,6 @@
import traceback import traceback
from shell.interfaces import CommandResult from neofs_testlib.shell.interfaces import CommandResult
def format_error_details(error: Exception) -> str: def format_error_details(error: Exception) -> str:

View file

@ -1,7 +1,8 @@
from unittest import TestCase from unittest import TestCase
from shell.interfaces import CommandOptions, InteractiveInput from neofs_testlib.shell.interfaces import CommandOptions, InteractiveInput
from shell.local_shell import LocalShell from neofs_testlib.shell.local_shell import LocalShell
from tests.helpers import format_error_details, get_output_lines from tests.helpers import format_error_details, get_output_lines

View file

@ -1,8 +1,9 @@
import os import os
from unittest import SkipTest, TestCase from unittest import SkipTest, TestCase
from shell.interfaces import CommandOptions, InteractiveInput from neofs_testlib.shell.interfaces import CommandOptions, InteractiveInput
from shell.ssh_shell import SSHShell from neofs_testlib.shell.ssh_shell import SSHShell
from tests.helpers import format_error_details, get_output_lines from tests.helpers import format_error_details, get_output_lines