Пример #1
0
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)
Пример #2
0
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
Пример #3
0
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()
Пример #4
0
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()
Пример #5
0
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")
Пример #6
0
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
Пример #7
0
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()
Пример #8
0
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()
Пример #9
0
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()
Пример #10
0
def main():
    my_cli = CLI(argv[1:])
    my_cli.run_script()

# flake8: noqa