forked from TrueCloudLab/frostfs-testlib
[#3] Move source code of testlib to src directory
Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
parent
c48f7b7ff2
commit
f5cd6a1954
41 changed files with 230 additions and 207 deletions
31
README.md
31
README.md
|
@ -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_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.
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
from .adm import NeofsAdm
|
||||
from .authmate import NeofsAuthmate
|
||||
from .go import NeoGo, NetworkType
|
|
@ -1 +0,0 @@
|
|||
from .adm import NeofsAdm
|
|
@ -1 +0,0 @@
|
|||
from .authmate import NeofsAuthmate
|
|
@ -1,2 +0,0 @@
|
|||
from .blockchain_network_type import NetworkType
|
||||
from .go import NeoGo
|
|
@ -1,3 +0,0 @@
|
|||
from .interfaces import CommandResult, Shell
|
||||
from .local_shell import LocalShell
|
||||
from .ssh_shell import SSHShell
|
3
src/neofs_testlib/cli/__init__.py
Normal file
3
src/neofs_testlib/cli/__init__.py
Normal 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
|
|
@ -1,13 +1,13 @@
|
|||
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
|
||||
map_params = {
|
||||
"json_mode": "json",
|
||||
|
@ -16,9 +16,9 @@ class NeofsCliCommand:
|
|||
"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.neofs_cli_exec = neofs_cli_exec
|
||||
self.cli_exec_path = cli_exec_path
|
||||
self.__base_params = " ".join(
|
||||
[f"--{param} {value}" for param, value in base_params.items() if value]
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ class NeofsCliCommand:
|
|||
|
||||
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:
|
||||
return self.shell.exec(self._format_command(command, **params))
|
1
src/neofs_testlib/cli/neofs_adm/__init__.py
Normal file
1
src/neofs_testlib/cli/neofs_adm/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from neofs_testlib.cli.neofs_adm.adm import NeofsAdm
|
|
@ -1,16 +1,14 @@
|
|||
from typing import Optional
|
||||
|
||||
from shell import Shell
|
||||
|
||||
from .config import NeofsAdmConfig
|
||||
from .morph import NeofsAdmMorph
|
||||
from .subnet import NeofsAdmMorphSubnet
|
||||
from .storage_config import NeofsAdmStorageConfig
|
||||
from .version import NeofsAdmVersion
|
||||
from neofs_testlib.cli.neofs_adm.config import NeofsAdmConfig
|
||||
from neofs_testlib.cli.neofs_adm.morph import NeofsAdmMorph
|
||||
from neofs_testlib.cli.neofs_adm.storage_config import NeofsAdmStorageConfig
|
||||
from neofs_testlib.cli.neofs_adm.subnet import NeofsAdmMorphSubnet
|
||||
from neofs_testlib.cli.neofs_adm.version import NeofsAdmVersion
|
||||
from neofs_testlib.shell import Shell
|
||||
|
||||
|
||||
class NeofsAdm:
|
||||
config: Optional[NeofsAdmConfig] = None
|
||||
morph: Optional[NeofsAdmMorph] = None
|
||||
subnet: Optional[NeofsAdmMorphSubnet] = None
|
||||
storage_config: Optional[NeofsAdmStorageConfig] = None
|
|
@ -1,8 +1,8 @@
|
|||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsAdmConfig(NeofsCliCommand):
|
||||
class NeofsAdmConfig(CliCommand):
|
||||
def init(self, path: str = "~/.neofs/adm/config.yml") -> CommandResult:
|
||||
"""Initialize basic neofs-adm configuration file.
|
||||
|
||||
|
@ -20,5 +20,5 @@ class NeofsAdmConfig(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,10 +1,10 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsAdmMorph(NeofsCliCommand):
|
||||
class NeofsAdmMorph(CliCommand):
|
||||
def deposit_notary(
|
||||
self,
|
||||
rpc_endpoint: str,
|
||||
|
@ -92,7 +92,7 @@ class NeofsAdmMorph(NeofsCliCommand):
|
|||
rpc_endpoint: str,
|
||||
cid: Optional[str] = None,
|
||||
container_contract: Optional[str] = None,
|
||||
dump: str = './testlib_dump_container',
|
||||
dump: str = "./testlib_dump_container",
|
||||
) -> CommandResult:
|
||||
"""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
|
||||
|
||||
Args:
|
||||
|
@ -284,7 +289,11 @@ class NeofsAdmMorph(NeofsCliCommand):
|
|||
)
|
||||
|
||||
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:
|
||||
"""Restore NeoFS containers from file.
|
||||
|
||||
|
@ -347,7 +356,10 @@ class NeofsAdmMorph(NeofsCliCommand):
|
|||
)
|
||||
|
||||
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:
|
||||
"""Update NeoFS contracts.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsAdmStorageConfig(NeofsCliCommand):
|
||||
class NeofsAdmStorageConfig(CliCommand):
|
||||
def set(self, account: str, wallet: str) -> CommandResult:
|
||||
"""Initialize basic neofs-adm configuration file.
|
||||
|
||||
|
@ -21,5 +21,5 @@ class NeofsAdmStorageConfig(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,11 +1,13 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsAdmMorphSubnet(NeofsCliCommand):
|
||||
def create(self, rpc_endpoint: str, address: str, wallet: str, notary: bool = False) -> CommandResult:
|
||||
class NeofsAdmMorphSubnet(CliCommand):
|
||||
def create(
|
||||
self, rpc_endpoint: str, address: str, wallet: str, notary: bool = False
|
||||
) -> CommandResult:
|
||||
"""Create NeoFS subnet.
|
||||
|
||||
Args:
|
||||
|
@ -25,7 +27,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def get(self, rpc_endpoint: str, subnet: str) -> CommandResult:
|
||||
|
@ -46,7 +48,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def remove(
|
||||
|
@ -71,7 +73,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def admin_add(
|
||||
|
@ -106,7 +108,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def admin_remove(
|
||||
|
@ -139,7 +141,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def client_add(
|
||||
|
@ -172,7 +174,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def client_remove(
|
||||
|
@ -205,7 +207,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def node_add(self, rpc_endpoint: str, wallet: str, node: str, subnet: str) -> CommandResult:
|
||||
|
@ -228,7 +230,7 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def node_remove(self, rpc_endpoint: str, wallet: str, node: str, subnet: str) -> CommandResult:
|
||||
|
@ -251,5 +253,5 @@ class NeofsAdmMorphSubnet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,8 +1,8 @@
|
|||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsAuthmateVersion(NeofsCliCommand):
|
||||
class NeofsAdmVersion(CliCommand):
|
||||
def get(self) -> CommandResult:
|
||||
"""Application version
|
||||
|
1
src/neofs_testlib/cli/neofs_authmate/__init__.py
Normal file
1
src/neofs_testlib/cli/neofs_authmate/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from neofs_testlib.cli.neofs_authmate.authmate import NeofsAuthmate
|
|
@ -1,20 +1,14 @@
|
|||
from typing import Optional
|
||||
|
||||
from shell import Shell
|
||||
|
||||
from .secret import NeofsAuthmateSecret
|
||||
from .version import NeofsAuthmateVersion
|
||||
from neofs_testlib.cli.neofs_authmate.secret import NeofsAuthmateSecret
|
||||
from neofs_testlib.cli.neofs_authmate.version import NeofsAuthmateVersion
|
||||
from neofs_testlib.shell import Shell
|
||||
|
||||
|
||||
class NeofsAuthmate:
|
||||
secret: Optional[NeofsAuthmateSecret] = None
|
||||
version: Optional[NeofsAuthmateVersion] = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
shell: Shell,
|
||||
neofs_authmate_exec_path: str,
|
||||
):
|
||||
|
||||
def __init__(self, shell: Shell, neofs_authmate_exec_path: str):
|
||||
self.secret = NeofsAuthmateSecret(shell, neofs_authmate_exec_path)
|
||||
self.version = NeofsAuthmateVersion(shell, neofs_authmate_exec_path)
|
|
@ -1,10 +1,10 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsAuthmateSecret(NeofsCliCommand):
|
||||
class NeofsAuthmateSecret(CliCommand):
|
||||
def obtain(
|
||||
self,
|
||||
wallet: str,
|
||||
|
@ -34,7 +34,7 @@ class NeofsAuthmateSecret(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def issue(
|
||||
|
@ -88,5 +88,5 @@ class NeofsAuthmateSecret(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,8 +1,8 @@
|
|||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsAdmVersion(NeofsCliCommand):
|
||||
class NeofsAuthmateVersion(CliCommand):
|
||||
def get(self) -> CommandResult:
|
||||
"""Application version
|
||||
|
2
src/neofs_testlib/cli/neogo/__init__.py
Normal file
2
src/neofs_testlib/cli/neogo/__init__.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
from neofs_testlib.cli.neogo.go import NeoGo
|
||||
from neofs_testlib.cli.neogo.network_type import NetworkType
|
|
@ -1,11 +1,10 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoCandidate(NeofsCliCommand):
|
||||
|
||||
class NeoGoCandidate(CliCommand):
|
||||
def register(
|
||||
self,
|
||||
address: str,
|
||||
|
@ -15,7 +14,7 @@ class NeoGoCandidate(NeofsCliCommand):
|
|||
gas: Optional[float] = None,
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
""" register as a new candidate
|
||||
"""Register as a new candidate
|
||||
|
||||
Args:
|
||||
address (str): Address to register
|
||||
|
@ -40,7 +39,7 @@ class NeoGoCandidate(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def unregister(
|
||||
|
@ -52,7 +51,7 @@ class NeoGoCandidate(NeofsCliCommand):
|
|||
gas: Optional[float] = None,
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
""" unregister self as a candidate
|
||||
"""Unregister self as a candidate
|
||||
|
||||
Args:
|
||||
address (str): Address to unregister
|
||||
|
@ -77,7 +76,7 @@ class NeoGoCandidate(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def vote(
|
||||
|
@ -103,7 +102,6 @@ class NeoGoCandidate(NeofsCliCommand):
|
|||
rpc_endpoint (str): RPC node address
|
||||
timeout (int): Timeout for the operation (default: 10s)
|
||||
|
||||
|
||||
Returns:
|
||||
str: Command string
|
||||
|
||||
|
@ -116,5 +114,5 @@ class NeoGoCandidate(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,10 +1,10 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoContract(NeofsCliCommand):
|
||||
class NeoGoContract(CliCommand):
|
||||
def compile(
|
||||
self,
|
||||
input_file: str,
|
||||
|
@ -16,7 +16,7 @@ class NeoGoContract(NeofsCliCommand):
|
|||
no_permissions: bool = False,
|
||||
bindings: Optional[str] = None,
|
||||
) -> CommandResult:
|
||||
"""compile a smart contract to a .nef file
|
||||
"""Compile a smart contract to a .nef file
|
||||
|
||||
Args:
|
||||
input_file (str): Input file for the smart contract to be compiled
|
||||
|
@ -55,9 +55,8 @@ class NeoGoContract(NeofsCliCommand):
|
|||
out: Optional[str] = None,
|
||||
force: bool = False,
|
||||
timeout: int = 10,
|
||||
|
||||
) -> CommandResult:
|
||||
"""deploy a smart contract (.nef with description)
|
||||
"""Deploy a smart contract (.nef with description)
|
||||
|
||||
Args:
|
||||
wallet (str): wallet to use to get the key for transaction signing;
|
||||
|
@ -97,7 +96,7 @@ class NeoGoContract(NeofsCliCommand):
|
|||
config: Optional[str] = None,
|
||||
manifest: Optional[str] = None,
|
||||
) -> CommandResult:
|
||||
"""generate wrapper to use in other contracts
|
||||
"""Generate wrapper to use in other contracts
|
||||
|
||||
Args:
|
||||
config (str): Configuration file to use
|
||||
|
@ -253,7 +252,7 @@ class NeoGoContract(NeofsCliCommand):
|
|||
name: str,
|
||||
skip_details: bool = False,
|
||||
) -> 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:
|
||||
name (str): name of the smart-contract to be initialized
|
||||
|
@ -277,7 +276,7 @@ class NeoGoContract(NeofsCliCommand):
|
|||
input_file: Optional[str] = None,
|
||||
compile: Optional[str] = None,
|
||||
) -> CommandResult:
|
||||
"""creates a user readable dump of the program instructions
|
||||
"""Creates a user readable dump of the program instructions
|
||||
|
||||
Args:
|
||||
input_file (str): input file of the program (either .go or .nef)
|
||||
|
@ -302,7 +301,7 @@ class NeoGoContract(NeofsCliCommand):
|
|||
manifest: str,
|
||||
sender: Optional[str] = None,
|
||||
) -> CommandResult:
|
||||
"""calculates hash of a contract after deployment
|
||||
"""Calculates hash of a contract after deployment
|
||||
|
||||
Args:
|
||||
input_file (str): path to NEF file
|
||||
|
@ -331,7 +330,7 @@ class NeoGoContract(NeofsCliCommand):
|
|||
sender: Optional[str] = None,
|
||||
nef: Optional[str] = None,
|
||||
) -> CommandResult:
|
||||
"""adds group to the manifest
|
||||
"""Adds group to the manifest
|
||||
|
||||
Args:
|
||||
wallet (str): wallet to use to get the key for transaction signing;
|
|
@ -1,12 +1,11 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
|
||||
from .blockchain_network_type import NetworkType
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.cli.neogo.network_type import NetworkType
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoDb(NeofsCliCommand):
|
||||
class NeoGoDb(CliCommand):
|
||||
def dump(
|
||||
self,
|
||||
config_path: str,
|
||||
|
@ -15,7 +14,7 @@ class NeoGoDb(NeofsCliCommand):
|
|||
count: int = 0,
|
||||
start: int = 0,
|
||||
) -> CommandResult:
|
||||
""" dump blocks (starting with block #1) to the file
|
||||
"""Dump blocks (starting with block #1) to the file
|
||||
|
||||
Args:
|
||||
config_path (str): path to config
|
||||
|
@ -36,7 +35,7 @@ class NeoGoDb(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def restore(
|
||||
|
@ -48,7 +47,7 @@ class NeoGoDb(NeofsCliCommand):
|
|||
dump: Optional[str] = None,
|
||||
incremental: bool = False,
|
||||
) -> CommandResult:
|
||||
""" dump blocks (starting with block #1) to the file
|
||||
"""Dump blocks (starting with block #1) to the file
|
||||
|
||||
Args:
|
||||
config_path (str): path to config
|
||||
|
@ -70,5 +69,5 @@ class NeoGoDb(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,20 +1,17 @@
|
|||
from typing import Optional
|
||||
|
||||
from shell import Shell
|
||||
|
||||
from .candidate import NeoGoCandidate
|
||||
from .contract import NeoGoContract
|
||||
from .db import NeoGoDb
|
||||
from .nep17 import NeoGoNep17
|
||||
from .node import NeoGoNode
|
||||
from .query import NeoGoQuery
|
||||
from .version import NeoGoVersion
|
||||
from .wallet import NeoGoWallet
|
||||
from neofs_testlib.cli.neogo.candidate import NeoGoCandidate
|
||||
from neofs_testlib.cli.neogo.contract import NeoGoContract
|
||||
from neofs_testlib.cli.neogo.db import NeoGoDb
|
||||
from neofs_testlib.cli.neogo.nep17 import NeoGoNep17
|
||||
from neofs_testlib.cli.neogo.node import NeoGoNode
|
||||
from neofs_testlib.cli.neogo.query import NeoGoQuery
|
||||
from neofs_testlib.cli.neogo.version import NeoGoVersion
|
||||
from neofs_testlib.cli.neogo.wallet import NeoGoWallet
|
||||
from neofs_testlib.shell import Shell
|
||||
|
||||
|
||||
class NeoGo:
|
||||
neo_go_exec_path: Optional[str] = None
|
||||
config_path: Optional[str] = None
|
||||
candidate: Optional[NeoGoCandidate] = None
|
||||
contract: Optional[NeoGoContract] = None
|
||||
db: Optional[NeoGoDb] = None
|
||||
|
@ -30,12 +27,8 @@ class NeoGo:
|
|||
neo_go_exec_path: Optional[str] = None,
|
||||
config_path: Optional[str] = None,
|
||||
):
|
||||
self.candidate = NeoGoCandidate(
|
||||
shell, neo_go_exec_path, config_path=config_path
|
||||
)
|
||||
self.contract = NeoGoContract(
|
||||
self.neo_go_exec_path, config_path=config_path
|
||||
)
|
||||
self.candidate = NeoGoCandidate(shell, neo_go_exec_path, config_path=config_path)
|
||||
self.contract = NeoGoContract(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.node = NeoGoNode(shell, neo_go_exec_path, config_path=config_path)
|
|
@ -1,10 +1,10 @@
|
|||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoNep17(NeofsCliCommand):
|
||||
class NeoGoNep17(CliCommand):
|
||||
def balance(
|
||||
self,
|
||||
address: str,
|
||||
|
@ -38,7 +38,7 @@ class NeoGoNep17(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def import_token(
|
||||
|
@ -74,7 +74,7 @@ class NeoGoNep17(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def info(
|
||||
|
@ -104,7 +104,7 @@ class NeoGoNep17(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def remove(
|
||||
|
@ -134,7 +134,7 @@ class NeoGoNep17(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def transfer(
|
||||
|
@ -188,13 +188,13 @@ class NeoGoNep17(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def multitransfer(
|
||||
self,
|
||||
token: str,
|
||||
to_address: List[str],
|
||||
to_address: list[str],
|
||||
sysgas: float,
|
||||
rpc_endpoint: str,
|
||||
wallet: Optional[str] = None,
|
||||
|
@ -204,7 +204,6 @@ class NeoGoNep17(NeofsCliCommand):
|
|||
force: bool = False,
|
||||
gas: Optional[float] = None,
|
||||
amount: float = 0,
|
||||
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
"""transfer NEP-17 tokens to multiple recipients
|
||||
|
@ -239,5 +238,5 @@ class NeoGoNep17(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,10 +1,9 @@
|
|||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
|
||||
from .blockchain_network_type import NetworkType
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.cli.neogo.network_type import NetworkType
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoNode(NeofsCliCommand):
|
||||
class NeoGoNode(CliCommand):
|
||||
def start(self, network: NetworkType = NetworkType.PRIVATE) -> CommandResult:
|
||||
"""Start a NEO node
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoQuery(NeofsCliCommand):
|
||||
class NeoGoQuery(CliCommand):
|
||||
def candidates(
|
||||
self,
|
||||
rpc_endpoint: str,
|
|
@ -1,8 +1,8 @@
|
|||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoVersion(NeofsCliCommand):
|
||||
class NeoGoVersion(CliCommand):
|
||||
def get(self) -> CommandResult:
|
||||
"""Application version
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
from typing import Optional
|
||||
|
||||
from cli.cli_command import NeofsCliCommand
|
||||
from shell import CommandResult
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeoGoWallet(NeofsCliCommand):
|
||||
class NeoGoWallet(CliCommand):
|
||||
def claim(
|
||||
self,
|
||||
address: str,
|
||||
|
@ -36,7 +36,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def init(
|
||||
|
@ -66,7 +66,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def convert(
|
||||
|
@ -96,7 +96,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def create(
|
||||
|
@ -124,7 +124,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def dump(
|
||||
|
@ -154,7 +154,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def dump_keys(
|
||||
|
@ -184,7 +184,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def export(
|
||||
|
@ -214,7 +214,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def import_wif(
|
||||
|
@ -248,7 +248,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def import_multisig(
|
||||
|
@ -282,7 +282,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def import_deployed(
|
||||
|
@ -293,7 +293,6 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
contract: Optional[str] = None,
|
||||
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
"""import multisig contract
|
||||
|
@ -321,7 +320,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def remove(
|
||||
|
@ -353,7 +352,7 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def sign(
|
||||
|
@ -391,5 +390,5 @@ class NeoGoWallet(NeofsCliCommand):
|
|||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
}
|
||||
},
|
||||
)
|
|
@ -1,8 +1,8 @@
|
|||
import os
|
||||
|
||||
from reporter.allure_reporter import AllureReporter
|
||||
from reporter.dummy_reporter import DummyReporter
|
||||
from reporter.interfaces import Reporter
|
||||
from neofs_testlib.reporter.allure_reporter import AllureReporter
|
||||
from neofs_testlib.reporter.dummy_reporter import DummyReporter
|
||||
from neofs_testlib.reporter.interfaces import Reporter
|
||||
|
||||
|
||||
def get_reporter() -> Reporter:
|
|
@ -6,7 +6,7 @@ from typing import Any
|
|||
import allure
|
||||
from allure import attachment_type
|
||||
|
||||
from reporter.interfaces import Reporter
|
||||
from neofs_testlib.reporter.interfaces import Reporter
|
||||
|
||||
|
||||
class AllureReporter(Reporter):
|
|
@ -1,7 +1,7 @@
|
|||
from contextlib import AbstractContextManager, contextmanager
|
||||
from typing import Any
|
||||
|
||||
from reporter.interfaces import Reporter
|
||||
from neofs_testlib.reporter.interfaces import Reporter
|
||||
|
||||
|
||||
@contextmanager
|
3
src/neofs_testlib/shell/__init__.py
Normal file
3
src/neofs_testlib/shell/__init__.py
Normal 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
|
|
@ -6,8 +6,8 @@ from typing import IO, Optional
|
|||
|
||||
import pexpect
|
||||
|
||||
from reporter import get_reporter
|
||||
from shell.interfaces import CommandOptions, CommandResult, Shell
|
||||
from neofs_testlib.reporter import get_reporter
|
||||
from neofs_testlib.shell.interfaces import CommandOptions, CommandResult, Shell
|
||||
|
||||
logger = logging.getLogger("neofs.testlib.shell")
|
||||
reporter = get_reporter()
|
|
@ -18,8 +18,8 @@ from paramiko import (
|
|||
)
|
||||
from paramiko.ssh_exception import AuthenticationException
|
||||
|
||||
from reporter import get_reporter
|
||||
from shell.interfaces import CommandOptions, CommandResult, Shell
|
||||
from neofs_testlib.reporter import get_reporter
|
||||
from neofs_testlib.shell.interfaces import CommandOptions, CommandResult, Shell
|
||||
|
||||
logger = logging.getLogger("neofs.testlib.shell")
|
||||
reporter = get_reporter()
|
|
@ -1,6 +1,6 @@
|
|||
import traceback
|
||||
|
||||
from shell.interfaces import CommandResult
|
||||
from neofs_testlib.shell.interfaces import CommandResult
|
||||
|
||||
|
||||
def format_error_details(error: Exception) -> str:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from shell.interfaces import CommandOptions, InteractiveInput
|
||||
from shell.local_shell import LocalShell
|
||||
from neofs_testlib.shell.interfaces import CommandOptions, InteractiveInput
|
||||
from neofs_testlib.shell.local_shell import LocalShell
|
||||
|
||||
from tests.helpers import format_error_details, get_output_lines
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import os
|
||||
from unittest import SkipTest, TestCase
|
||||
|
||||
from shell.interfaces import CommandOptions, InteractiveInput
|
||||
from shell.ssh_shell import SSHShell
|
||||
from neofs_testlib.shell.interfaces import CommandOptions, InteractiveInput
|
||||
from neofs_testlib.shell.ssh_shell import SSHShell
|
||||
|
||||
from tests.helpers import format_error_details, get_output_lines
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue