Skip balance tests when storage is free
This is an alternative implementation of PR https://github.com/nspcc-dev/neofs-testcases/pull/304 Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
parent
fed50cb96d
commit
d28d7c6e6d
1 changed files with 10 additions and 15 deletions
|
@ -1,19 +1,19 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import allure
|
||||||
import pytest
|
import pytest
|
||||||
import yaml
|
import yaml
|
||||||
from cli_utils import NeofsCli
|
from cli_utils import NeofsCli
|
||||||
from common import ASSETS_DIR, NEOFS_ENDPOINT, WALLET_CONFIG
|
from common import ASSETS_DIR, FREE_STORAGE, NEOFS_ENDPOINT, WALLET_CONFIG
|
||||||
from python_keywords.payment_neogo import _address_from_wallet
|
from python_keywords.payment_neogo import _address_from_wallet
|
||||||
from wallet import init_wallet
|
from wallet import init_wallet
|
||||||
|
|
||||||
import allure
|
|
||||||
|
|
||||||
logger = logging.getLogger("NeoLogger")
|
logger = logging.getLogger("NeoLogger")
|
||||||
DEPOSIT_AMOUNT = 30
|
DEPOSIT_AMOUNT = 30
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.payments
|
@pytest.mark.payments
|
||||||
|
@pytest.mark.skipif(FREE_STORAGE, reason="Test only works on public network with paid storage")
|
||||||
class TestBalanceAccounting:
|
class TestBalanceAccounting:
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def prepare_two_wallets(self, prepare_wallet_and_deposit):
|
def prepare_two_wallets(self, prepare_wallet_and_deposit):
|
||||||
|
@ -25,26 +25,23 @@ class TestBalanceAccounting:
|
||||||
def test_balance_wallet_address(self):
|
def test_balance_wallet_address(self):
|
||||||
cli = NeofsCli(config=WALLET_CONFIG)
|
cli = NeofsCli(config=WALLET_CONFIG)
|
||||||
output = cli.accounting.balance(
|
output = cli.accounting.balance(
|
||||||
wallet=self.user_wallet, rpc_endpoint=NEOFS_ENDPOINT, address=self.address
|
wallet=self.user_wallet,
|
||||||
|
rpc_endpoint=NEOFS_ENDPOINT,
|
||||||
|
address=self.address,
|
||||||
)
|
)
|
||||||
logger.info(f"Out wallet+addres: {output}")
|
logger.info(f"Out wallet+address: {output}")
|
||||||
assert int(output.rstrip()) == DEPOSIT_AMOUNT
|
assert int(output.rstrip()) == DEPOSIT_AMOUNT
|
||||||
|
|
||||||
@allure.title("Test balance request with wallet only")
|
@allure.title("Test balance request with wallet only")
|
||||||
def test_balance_wallet(self):
|
def test_balance_wallet(self):
|
||||||
cli = NeofsCli(config=WALLET_CONFIG)
|
cli = NeofsCli(config=WALLET_CONFIG)
|
||||||
output = cli.accounting.balance(
|
output = cli.accounting.balance(wallet=self.user_wallet, rpc_endpoint=NEOFS_ENDPOINT)
|
||||||
wallet=self.user_wallet,
|
|
||||||
rpc_endpoint=NEOFS_ENDPOINT,
|
|
||||||
)
|
|
||||||
logger.info(f"Out wallet: {output}")
|
logger.info(f"Out wallet: {output}")
|
||||||
assert int(output.rstrip()) == DEPOSIT_AMOUNT
|
assert int(output.rstrip()) == DEPOSIT_AMOUNT
|
||||||
|
|
||||||
@allure.title("Test balance request with wallet and wrong address")
|
@allure.title("Test balance request with wallet and wrong address")
|
||||||
def test_balance_wrong_address(self):
|
def test_balance_wrong_address(self):
|
||||||
with pytest.raises(
|
with pytest.raises(Exception, match="address option must be specified and valid"):
|
||||||
Exception, match="address option must be specified and valid"
|
|
||||||
):
|
|
||||||
cli = NeofsCli(config=WALLET_CONFIG)
|
cli = NeofsCli(config=WALLET_CONFIG)
|
||||||
cli.accounting.balance(
|
cli.accounting.balance(
|
||||||
wallet=self.user_wallet,
|
wallet=self.user_wallet,
|
||||||
|
@ -54,9 +51,7 @@ class TestBalanceAccounting:
|
||||||
|
|
||||||
@allure.title("Test balance request with config file")
|
@allure.title("Test balance request with config file")
|
||||||
def test_balance_api(self):
|
def test_balance_api(self):
|
||||||
config_file = self.write_api_config(
|
config_file = self.write_api_config(endpoint=NEOFS_ENDPOINT, wallet=self.user_wallet)
|
||||||
endpoint=NEOFS_ENDPOINT, wallet=self.user_wallet
|
|
||||||
)
|
|
||||||
logger.info(f"YAML: {config_file}")
|
logger.info(f"YAML: {config_file}")
|
||||||
cli = NeofsCli(config=config_file)
|
cli = NeofsCli(config=config_file)
|
||||||
output = cli.accounting.balance()
|
output = cli.accounting.balance()
|
||||||
|
|
Loading…
Reference in a new issue