diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f399b1fb..544827dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,6 +58,7 @@ jobs: run: | export SNET_TEST_WALLET_PRIVATE_KEY=${{ secrets.PRIV_KEY }} export SNET_TEST_INFURA_KEY=${{ secrets.INF_KEY }} + export SNET_TEST_WALLET_ADDRESS=${{ secrets.ADDR }} export FORMER_SNET_TEST_INFURA_KEY=${{ secrets.FORM_INF_KEY }} export PIP_BREAK_SYSTEM_PACKAGES=1 export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python diff --git a/snet/cli/test/functional_tests/func_tests.py b/snet/cli/test/functional_tests/func_tests.py index 3f0c24a6..fb9df52f 100644 --- a/snet/cli/test/functional_tests/func_tests.py +++ b/snet/cli/test/functional_tests/func_tests.py @@ -15,6 +15,12 @@ from snet.cli.config import Config +INFURA_KEY = os.environ.get("SNET_TEST_INFURA_KEY") +PRIVATE_KEY = os.environ.get("SNET_TEST_WALLET_PRIVATE_KEY") +ADDR = os.environ.get("SNET_TEST_WALLET_ADDRESS") +INFURA = f"https://sepolia.infura.io/v3/{INFURA_KEY}" +IDENTITY = "main" + class StringOutput: def __init__(self): @@ -37,6 +43,7 @@ def execute(args_list, parser, conf): except Exception as e: raise + class BaseTest(unittest.TestCase): def setUp(self): self.conf = Config() @@ -44,6 +51,26 @@ def setUp(self): argcomplete.autocomplete(self.parser) +class TestMainPreparations(BaseTest): + def setUp(self): + super().setUp() + + def test_1_set_infura(self): + execute(["set", "default_eth_rpc_endpoint", INFURA], self.parser, self.conf) + result = execute(["session"], self.parser, self.conf) + assert INFURA_KEY in result + + def test_2_identity_create(self): + execute(["identity", "create", IDENTITY, "key", "--private-key", PRIVATE_KEY, "-de"], self.parser, self.conf) + result = execute(["session"], self.parser, self.conf) + assert f"identity: {IDENTITY}" in result + + def test_3_set_network(self): + execute(["network", "sepolia"], self.parser, self.conf) + result = execute(["session"], self.parser, self.conf) + assert "network: sepolia" in result + + class TestCommands(BaseTest): def test_balance_output(self): result = execute(["account", "balance"], self.parser, self.conf) @@ -51,7 +78,7 @@ def test_balance_output(self): def test_balance_address(self): result = execute(["account", "balance"], self.parser, self.conf) - assert result.split("\n")[0].split()[1] == "0xe5D1fA424DE4689F9d2687353b75D7a8987900fD" + assert result.split("\n")[0].split()[1] == ADDR class TestDepositWithdraw(BaseTest): def setUp(self):