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 test_unique_container_registry_username_tokens():
unique = set()
length_container_registry_username = len('container_registry_username')
is_unique = True
output = Output()
envvars = EnvVars(output)
envvars.load()
for key in os.environ:
key = key.lower()
if key.startswith('container_registry_username'):
token = key[length_container_registry_username:]
if token not in unique:
unique.add(token)
else:
is_unique = False
assert is_unique
def test_in_command_list_empty_2():
output = Output()
envvars = EnvVars(output)
assert not envvars.in_command_list("solution new test_solution", ["init", "e2e", "", "new", "simulator stop"])
def test_default_container_registry_password_value_exists_or_returns_empty_string():
output = Output()
envvars = EnvVars(output)
password = envvars.get_envvar("CONTAINER_REGISTRY_PASSWORD")
assert password is not None
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_additional_container_registry_map_has_val(setup_test_env):
output = Output()
envvars = EnvVars(output)
envvars.load()
assert len(envvars.CONTAINER_REGISTRY_MAP) == 2
assert 'UNITTEST' in envvars.CONTAINER_REGISTRY_MAP.keys()
assert envvars.CONTAINER_REGISTRY_MAP['UNITTEST'].server == 'unittest.azurecr.io'
assert envvars.CONTAINER_REGISTRY_MAP['UNITTEST'].username == 'username'
assert envvars.CONTAINER_REGISTRY_MAP['UNITTEST'].password == 'password'
def test_is_terse_command_empty():
output = Output()
envvars = EnvVars(output)
assert envvars.is_terse_command("")
def test_unique_container_registry_password_tokens():
unique = set()
length_container_registry_password = len('container_registry_password')
is_unique = True
output = Output()
envvars = EnvVars(output)
envvars.load()
for key in os.environ:
key = key.lower()
if key.startswith('container_registry_password'):
token = key[length_container_registry_password:]
if token not in unique:
unique.add(token)
else:
is_unique = False
assert is_unique
import pytest
import shutil
import time
from iotedgedev.compat import PY35
from iotedgedev.envvars import EnvVars
from iotedgedev.output import Output
from .utility import get_docker_os_type
from .utility import get_platform_type
from .utility import runner_invoke
pytestmark = pytest.mark.e2e
output = Output()
envvars = EnvVars(output)
env_file_name = envvars.get_dotenv_file()
env_file_path = envvars.get_dotenv_path(env_file_name)
root_dir = os.getcwd()
tests_dir = os.path.join(root_dir, 'tests')
test_solution = 'test_solution'
test_solution_dir = os.path.join(tests_dir, test_solution)
@pytest.fixture(scope="module", autouse=True)
def create_solution(request):
os.chdir(tests_dir)
result = runner_invoke(['solution', 'new', test_solution])
def deployment_manifest():
output = Output()
envvars = EnvVars(output)
envvars.load()
utility = Utility(envvars, output)
def _deployment_manifest(path):
return DeploymentManifest(envvars, output, utility, path, True)
return _deployment_manifest