Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Fehrs committed May 13, 2024
1 parent 52999e8 commit f042785
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 157 deletions.
32 changes: 16 additions & 16 deletions node-runner-cli/tests/unit/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ class DockerUnitTests(unittest.TestCase):
def test_docker_config(self, mockout):
urllib3.disable_warnings()
with patch(
"builtins.input",
side_effect=["N", "N", "/home/runner/docker-compose.yml", "N"],
"builtins.input",
side_effect=["N", "N", "/home/runner/docker-compose.yml", "N"],
):
with patch(
"sys.argv",
[
"main",
"docker",
"config",
"-m",
"DETAILED",
"-n",
"2",
"-k",
"radix",
"-nk",
"-a",
],
"sys.argv",
[
"main",
"docker",
"config",
"-m",
"DETAILED",
"-n",
"2",
"-k",
"radix",
"-nk",
"-a",
],
):
main()

Expand Down
2 changes: 1 addition & 1 deletion node-runner-cli/tests/unit/test_gateway_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_setup_gateway_compose_file_fixture_test(self, mockout):
self.assertEqual(f1.read(), f2.read())

def expect_ask_gateway_inputs_get_inserted_into_object(
self, config, questionary_keyboard_input
self, config, questionary_keyboard_input
):
self.assertEqual(
questionary_keyboard_input[0],
Expand Down
14 changes: 7 additions & 7 deletions node-runner-cli/tests/unit/test_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,24 @@ def test_template_failure(self, mock_stdout):
@mock.patch("sys.stdout", new_callable=StringIO)
def test_monitoring_config(self, mock_out):
with mock.patch(
"builtins.input",
side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"],
"builtins.input",
side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"],
):
with mock.patch("sys.argv", ["main", "monitoring", "config"]):
main()

with mock.patch(
"sys.argv",
["main", "monitoring", "config", "-m", "MONITOR_CORE", "-cm", "test"],
"sys.argv",
["main", "monitoring", "config", "-m", "MONITOR_CORE", "-cm", "test"],
):
main()

with mock.patch(
"builtins.input",
side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"],
"builtins.input",
side_effect=["Y", "https://45.152.180.182", "metrics", "testpassword", "n"],
):
with mock.patch(
"sys.argv", ["main", "monitoring", "config", "-m", "DETAILED"]
"sys.argv", ["main", "monitoring", "config", "-m", "DETAILED"]
):
main()

Expand Down
156 changes: 78 additions & 78 deletions node-runner-cli/tests/unit/test_prompt_feeder_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,48 +38,48 @@ def test_docker_config_gateway_external_postgres(self, mockout):
PROMPT_NGINX_IMAGE_VERSION = ""
PROMPT_CONFIRM_CONFIG = "Y"
with patch(
"builtins.input",
side_effect=[
PROMPT_NETWORKID,
PROMPT_FULLNODE_YES_NO,
# PROMPT_SEEDNODES,
PROMPT_VALIDATOR_ADDRESS,
PROMPT_EXISTING_KEYSTORE,
PROMPT_KEYSTORE_LOCATION,
PROMPT_KEYSTORE_FILE_NAME,
PROMPT_LEDGER_LOCATION,
PROMPT_NGINX_PROTECT_CORE_API,
PROMPT_ENABLE_GATEWAY,
PROMPT_GATEWAY_CORE_API_URL,
PROMPT_GATEWAY_CORE_API_NAME,
PROMPT_POSTGRES_LOCAL_REMOTE,
PROMPT_POSTGRES_REMOTE_URL,
PROMPT_POSTGRES_REMOTE_PORT,
PROMPT_POSTGRES_DATABASE_NAME,
PROMPT_POSTGRES_USERNAME,
PROMPT_POSTGRES_PASSWORD,
PROMPT_GATEWAY_IMAGE_VERSION,
PROMPT_MIGRATION_IMAGE_VERSION,
PROMPT_AGGREGATOR_IMAGE_VERSION,
PROMPT_NGINX_PROTECT_GATEWAY,
PROMPT_NGINX_IMAGE_VERSION,
PROMPT_CONFIRM_CONFIG,
],
"builtins.input",
side_effect=[
PROMPT_NETWORKID,
PROMPT_FULLNODE_YES_NO,
# PROMPT_SEEDNODES,
PROMPT_VALIDATOR_ADDRESS,
PROMPT_EXISTING_KEYSTORE,
PROMPT_KEYSTORE_LOCATION,
PROMPT_KEYSTORE_FILE_NAME,
PROMPT_LEDGER_LOCATION,
PROMPT_NGINX_PROTECT_CORE_API,
PROMPT_ENABLE_GATEWAY,
PROMPT_GATEWAY_CORE_API_URL,
PROMPT_GATEWAY_CORE_API_NAME,
PROMPT_POSTGRES_LOCAL_REMOTE,
PROMPT_POSTGRES_REMOTE_URL,
PROMPT_POSTGRES_REMOTE_PORT,
PROMPT_POSTGRES_DATABASE_NAME,
PROMPT_POSTGRES_USERNAME,
PROMPT_POSTGRES_PASSWORD,
PROMPT_GATEWAY_IMAGE_VERSION,
PROMPT_MIGRATION_IMAGE_VERSION,
PROMPT_AGGREGATOR_IMAGE_VERSION,
PROMPT_NGINX_PROTECT_GATEWAY,
PROMPT_NGINX_IMAGE_VERSION,
PROMPT_CONFIRM_CONFIG,
],
):
with patch(
"sys.argv",
[
"main",
"docker",
"config",
"-m",
"DETAILED",
"-k",
"radix",
"-nk",
"-t",
"asdasd",
],
"sys.argv",
[
"main",
"docker",
"config",
"-m",
"DETAILED",
"-k",
"radix",
"-nk",
"-t",
"asdasd",
],
):
main()

Expand Down Expand Up @@ -112,46 +112,46 @@ def test_docker_config_all_local(self, mockout):
PROMPT_NGINX_IMAGE_VERSION = ""
PROMPT_CONFIRM_CONFIG = "Y"
with patch(
"builtins.input",
side_effect=[
PROMPT_NETWORKID,
PROMPT_FULLNODE_YES_NO,
PROMPT_SEEDNODES,
PROMPT_VALIDATOR_ADDRESS,
PROMPT_EXISTING_KEYSTORE,
PROMPT_KEYSTORE_LOCATION,
PROMPT_KEYSTORE_FILE_NAME,
PROMPT_LEDGER_LOCATION,
PROMPT_NGINX_PROTECT_CORE_API,
PROMPT_ENABLE_GATEWAY,
PROMPT_GATEWAY_CORE_API_URL,
PROMPT_GATEWAY_CORE_API_NAME,
PROMPT_POSTGRES_LOCAL_REMOTE,
PROMPT_POSTGRES_USERNAME,
PROMPT_POSTGRES_DATABASE_NAME,
PROMPT_POSTGRES_PASSWORD,
PROMPT_GATEWAY_IMAGE_VERSION,
PROMPT_MIGRATION_IMAGE_VERSION,
PROMPT_AGGREGATOR_IMAGE_VERSION,
PROMPT_NGINX_PROTECT_GATEWAY,
PROMPT_NGINX_IMAGE_VERSION,
],
"builtins.input",
side_effect=[
PROMPT_NETWORKID,
PROMPT_FULLNODE_YES_NO,
PROMPT_SEEDNODES,
PROMPT_VALIDATOR_ADDRESS,
PROMPT_EXISTING_KEYSTORE,
PROMPT_KEYSTORE_LOCATION,
PROMPT_KEYSTORE_FILE_NAME,
PROMPT_LEDGER_LOCATION,
PROMPT_NGINX_PROTECT_CORE_API,
PROMPT_ENABLE_GATEWAY,
PROMPT_GATEWAY_CORE_API_URL,
PROMPT_GATEWAY_CORE_API_NAME,
PROMPT_POSTGRES_LOCAL_REMOTE,
PROMPT_POSTGRES_USERNAME,
PROMPT_POSTGRES_DATABASE_NAME,
PROMPT_POSTGRES_PASSWORD,
PROMPT_GATEWAY_IMAGE_VERSION,
PROMPT_MIGRATION_IMAGE_VERSION,
PROMPT_AGGREGATOR_IMAGE_VERSION,
PROMPT_NGINX_PROTECT_GATEWAY,
PROMPT_NGINX_IMAGE_VERSION,
],
):
with patch(
"sys.argv",
[
"main",
"docker",
"config",
"-m",
"DETAILED",
"-k",
"radix",
"-nk",
"-a",
"-d",
"/tmp",
],
"sys.argv",
[
"main",
"docker",
"config",
"-m",
"DETAILED",
"-k",
"radix",
"-nk",
"-a",
"-d",
"/tmp",
],
):
main()

Expand Down
110 changes: 55 additions & 55 deletions node-runner-cli/tests/unit/test_systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ def test_systemd_install_continue_prompt_feed(self):
@unittest.skip("Can only be executed on Ubuntu")
def test_systemd_config_can_run_without_prompt(self):
with patch(
"sys.argv",
[
"main",
"systemd",
"config",
"-a",
"-t",
"somenode",
"-i",
"123.123.123.123",
"-k",
"password",
"-n",
"S",
"-d",
"/tmp/config",
"-dd",
"/tmp/babylon-ledger",
],
"sys.argv",
[
"main",
"systemd",
"config",
"-a",
"-t",
"somenode",
"-i",
"123.123.123.123",
"-k",
"password",
"-n",
"S",
"-d",
"/tmp/config",
"-dd",
"/tmp/babylon-ledger",
],
):
main()

Expand Down Expand Up @@ -111,48 +111,48 @@ def test_systemd_config(self, mockout):
)
with patch("builtins.input", side_effect=["Y"]):
with patch(
"sys.argv",
[
"main",
"systemd",
"config",
"-m",
"CORE",
"-i",
"18.133.170.30",
"-t",
"radix://tn1q28eygvxshszxk48jhjxdmyne06m3x6hfyvxg7a45qt8cksffx6z7uu6392@15.236.228.96",
"-n",
"2",
"-k",
"radix",
"-d",
"/tmp",
"-dd",
"/tmp",
"-v",
"randomvalidatoraddress",
"-nk",
"-a",
"-r",
"1",
],
"sys.argv",
[
"main",
"systemd",
"config",
"-m",
"CORE",
"-i",
"18.133.170.30",
"-t",
"radix://tn1q28eygvxshszxk48jhjxdmyne06m3x6hfyvxg7a45qt8cksffx6z7uu6392@15.236.228.96",
"-n",
"2",
"-k",
"radix",
"-d",
"/tmp",
"-dd",
"/tmp",
"-v",
"randomvalidatoraddress",
"-nk",
"-a",
"-r",
"1",
],
):
main()

@unittest.skip("For verification only")
def test_systemd_install_manual(self):
with patch(
"sys.argv",
[
"main",
"systemd",
"install",
"-a",
"-m",
"-f",
"/tmp/babylon-node/test-config.yaml",
],
"sys.argv",
[
"main",
"systemd",
"install",
"-a",
"-m",
"-f",
"/tmp/babylon-node/test-config.yaml",
],
):
main()

Expand Down

0 comments on commit f042785

Please sign in to comment.