Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_container_registry_server_key_missing_sys_exit():
output = Output()
envvars = EnvVars(output)
with pytest.raises(ValueError):
envvars.get_envvar("CONTAINER_REGISTRY_SERVER_UNITTEST", required=True)
def utility():
output = Output()
envvars = EnvVars(output)
envvars.load()
return Utility(envvars, output)
def test_in_command_list_empty_3():
output = Output()
envvars = EnvVars(output)
assert envvars.in_command_list("", ["init", "e2e", "", "new", "simulator stop"])
def setup_test_env(request):
output = Output()
envvars = EnvVars(output)
envvars.set_envvar("CONTAINER_REGISTRY_SERVER_UNITTEST", 'unittest.azurecr.io')
envvars.set_envvar("CONTAINER_REGISTRY_USERNAME_UNITTEST", 'username')
envvars.set_envvar("CONTAINER_REGISTRY_PASSWORD_UNITTEST", 'password')
def clean():
os.environ.pop("CONTAINER_REGISTRY_SERVER_UNITTEST")
os.environ.pop("CONTAINER_REGISTRY_USERNAME_UNITTEST")
os.environ.pop("CONTAINER_REGISTRY_PASSWORD_UNITTEST")
request.addfinalizer(clean)
return
def test_is_terse_command_empty():
output = Output()
envvars = EnvVars(output)
assert envvars.is_terse_command("")
def test_default_container_registry_server_key_exists():
output = Output()
envvars = EnvVars(output)
envvars.load()
assert "CONTAINER_REGISTRY_SERVER" in os.environ
def test_default_container_registry_username_value_exists_or_returns_empty_string():
output = Output()
envvars = EnvVars(output)
username = envvars.get_envvar("CONTAINER_REGISTRY_USERNAME")
assert username is not None
def test_is_terse_command_false():
output = Output()
envvars = EnvVars(output)
assert not envvars.is_terse_command("solution add")
def test_default_container_registry_server_value_exists():
output = Output()
envvars = EnvVars(output)
server = envvars.get_envvar("CONTAINER_REGISTRY_SERVER")
assert server is not None
def test_set_envvar():
output = Output()
envvars = EnvVars(output)
registry_server = envvars.get_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE")
envvars.set_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE", "deployment.template_new.json")
new_registry_server = envvars.get_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE")
assert new_registry_server == "deployment.template_new.json"
envvars.set_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE", registry_server)