def test_no_key_option_with_adding_variables(base_args_with_vars): base_args_with_vars.append('--no-key') my_cli = CLI(base_args_with_vars) my_cli.run_script() env_file = my_cli.get_env_file() file_list = listdir(path.dirname(env_file.get_filepath())) assert not is_there_a_pem_file(file_list)
def test_no_key_option(base_args): base_args.append('--no-key') my_cli = CLI(base_args) my_cli.run_script() env_file = my_cli.get_env_file() is_there_a_pem = False for file in listdir(path.dirname(env_file.get_filepath())): if file == 'my_key.pem': is_there_a_pem = True assert not is_there_a_pem
def test_clear_option_on_binary(base_args, base_args_with_vars_encrypted): my_cli = CLI(base_args_with_vars_encrypted) my_cli.run_script() env_file = my_cli.get_env_file() assert not env_file.is_empty() base_args.append('--clear') my_cli = CLI(base_args) my_cli.run_script() assert env_file.is_empty()
def test_append_variables_on_encrypted_file(base_args_with_vars_encrypted): my_cli = CLI(base_args_with_vars_encrypted) my_cli.run_script() base_args_with_vars_encrypted.append('-a') base_args_with_vars_encrypted.append('test3=123415') my_cli = CLI(base_args_with_vars_encrypted) my_cli.run_script() assert 'test3=123415' and 'test1=123' and 'test=123' \ in my_cli.get_env_file().get_decrypted_lines_as_list()
def test_plaintext_is_too_long_error(base_args): base_args.append('-a') my_string = "Lorem Ipsum is simply dummy text of \ the printing and typesetting industry. Lorem Ipsum has \ been the industry's standard dummy text ever since the \ 1500s, when an unknown printer took a galley of type \ and scrambled if I was I big b" print("*****************************************", len(my_string)) base_args.append(my_string) base_args.append('-E') my_cli = CLI(base_args) try: my_cli.run_script() except ValueError: fail("Plaintext is too long")
def test_list_variables_option_without_encryption( base_args, base_args_with_vars): my_cli = CLI(base_args_with_vars) my_cli.run_script() base_args.append('-l') old_stdout = sys.stdout sys.stdout = mystdout = StringIO() my_cli = CLI(base_args) my_cli.run_script() sys.stdout = old_stdout stdout_value = mystdout.getvalue() assert 'test' and 'test1' in stdout_value
def test_append_variables(base_args_with_vars): my_cli = CLI(base_args_with_vars) my_cli.run_script() env_file = my_cli.get_env_file() assert env_file.filepath_exists() assert not env_file.is_empty()
def test_environment_path(base_args): my_cli = CLI(base_args) my_cli.run_script() env_file = my_cli.get_env_file() assert env_file.filepath_exists() assert env_file.environment_path.is_dir()
def test_dot_env_file_option(base_args): base_args.append('--dot-env-file') base_args.append('ENV') my_cli = CLI(base_args) my_cli.run_script() assert my_cli.get_env_file().filepath_exists()
def main(): my_cli = CLI(argv[1:]) my_cli.run_script() # flake8: noqa