From 3854dc24746eea62d9061e097690fa9a4a6bbd29 Mon Sep 17 00:00:00 2001 From: Evgeny Gusarov Date: Tue, 10 Oct 2023 21:41:28 +0300 Subject: [PATCH] Fix missing data-dir mock --- src/commands/tests/test_create_keys.py | 4 +++ src/commands/tests/test_init.py | 44 +++++++++++++++++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/commands/tests/test_create_keys.py b/src/commands/tests/test_create_keys.py index 61e0f58e..b597526f 100644 --- a/src/commands/tests/test_create_keys.py +++ b/src/commands/tests/test_create_keys.py @@ -32,6 +32,8 @@ def test_basic( str(vault_address), '--data-dir', str(data_dir), + '--pool-size', + '2', ] result = runner.invoke(create_keys, args) assert result.exit_code == 0 @@ -76,6 +78,8 @@ def test_per_keystore_password( str(vault_address), '--data-dir', str(data_dir), + '--pool-size', + '2', '--per-keystore-password', ] result = runner.invoke(create_keys, args) diff --git a/src/commands/tests/test_init.py b/src/commands/tests/test_init.py index debf121a..5346b08f 100644 --- a/src/commands/tests/test_init.py +++ b/src/commands/tests/test_init.py @@ -10,34 +10,62 @@ @patch('src.common.language.get_mnemonic', return_value=mnemonic) class TestCreateMnemonic: - def test_basic(self, mnemonic_mock, runner: CliRunner): + def test_basic(self, mnemonic_mock, data_dir, runner: CliRunner): vault = faker.eth_address() - args = ['--language', 'english', '--vault', vault, '--network', 'goerli'] + args = [ + '--data-dir', + str(data_dir), + '--language', + 'english', + '--vault', + vault, + '--network', + 'goerli', + ] result = runner.invoke(init, args, input=f'\n{mnemonic}\n') assert result.exit_code == 0 mnemonic_mock.assert_called_once() assert mnemonic in result.output.strip() assert 'Successfully initialized configuration' in result.output.strip() - def test_bad_verify(self, mnemonic_mock, runner: CliRunner): + def test_bad_verify(self, mnemonic_mock, data_dir, runner: CliRunner): vault = faker.eth_address() - args = ['--language', 'english', '--vault', vault, '--network', 'goerli'] + args = [ + '--data-dir', + str(data_dir), + '--language', + 'english', + '--vault', + vault, + '--network', + 'goerli', + ] result = runner.invoke(init, args, input=f'\n{mnemonic} bad\n\n{mnemonic}\n') assert result.exit_code == 0 mnemonic_mock.assert_called_once() assert mnemonic in result.output.strip() assert 'Successfully initialized configuration' in result.output.strip() - def test_no_verify(self, mnemonic_mock, runner: CliRunner): + def test_no_verify(self, mnemonic_mock, data_dir, runner: CliRunner): vault = faker.eth_address() - args = ['--language', 'english', '--no-verify', '--vault', vault, '--network', 'goerli'] + args = [ + '--data-dir', + str(data_dir), + '--language', + 'english', + '--no-verify', + '--vault', + vault, + '--network', + 'goerli', + ] result = runner.invoke(init, args) assert result.exit_code == 0 mnemonic_mock.assert_called_once() assert mnemonic == result.output.strip() - def test_bad_language(self, _, runner: CliRunner): - args = ['--language', 'bad', '--no-verify'] + def test_bad_language(self, data_dir, runner: CliRunner): + args = ['--data-dir', str(data_dir), '--language', 'bad', '--no-verify'] result = runner.invoke(init, args) assert result.exit_code == 2 assert "Invalid value for '--language': 'bad' is not one of" in result.output.strip()