Skip to content

Commit

Permalink
Fix unittest for node wizard after adding allowed_algorithms questions
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvanb committed Feb 16, 2024
1 parent d11d5eb commit e407d25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions vantage6/tests_cli/test_wizard.py
Expand Up @@ -38,6 +38,9 @@ def test_node_wizard(self):
True, # add a database
False, # don't enable two-factor authentication
True, # add VPN server
True, # add algorithm policies
"some-image", # algorithm image to whitelist
False, # don't add another algorithm image
False, # don't abort if no server connection is made to pull
# collaboration settings
True, # Enable encryption
Expand All @@ -58,6 +61,12 @@ def test_node_wizard(self):
]
for key in keys:
self.assertIn(key, config)
nested_keys = [["policies", "allowed_algorithms"]]
for nesting in nested_keys:
current_config = config
for key in nesting:
self.assertIn(key, current_config)
current_config = current_config[key]

def test_server_wizard(self):
with patch(f"{module_path}.q") as q:
Expand Down
12 changes: 6 additions & 6 deletions vantage6/vantage6/cli/configuration_wizard.py
Expand Up @@ -6,7 +6,7 @@
from vantage6.common.globals import DATABASE_TYPES, InstanceType
from vantage6.common.client.node_client import NodeClient
from vantage6.common.context import AppContext
from vantage6.common import error, warning
from vantage6.common import error, warning, info
from vantage6.cli.context import select_context_class
from vantage6.cli.configuration_manager import (
NodeConfigurationManager,
Expand Down Expand Up @@ -103,13 +103,13 @@ def node_configuration_questionaire(dirs: dict, instance_name: str) -> dict:
).ask()
if is_policies:
allowed_algorithms = []
print("Below you can add algorithms that are allowed to run on your node.")
print("You can use regular expressions to match multiple algorithms.")
print("Examples:")
info("Below you can add algorithms that are allowed to run on your node.")
info("You can use regular expressions to match multiple algorithms.")
info("Examples:")
# pylint: disable=W1401
# flake8: noqa: W605
print("^harbor2\.vantage6\.ai/demo/average Allow the demo average algorithm")
print(
info("^harbor2\.vantage6\.ai/demo/average Allow the demo average algorithm")
info(
"^harbor2\.vantage6\.ai/algorithms/.* Allow all algorithms from "
"harbor2.vantage6.ai/algorithms"
)
Expand Down

0 comments on commit e407d25

Please sign in to comment.