def test_create_ca_supporting_dirs(tmpdir):
    config = _get_config()
    tls_dict = mount_efs.tls_paths_dictionary(MOUNT_NAME, str(tmpdir))
    mount_efs.ca_dirs_check(config, tls_dict['database_dir'],
                            tls_dict['certs_dir'])
    assert os.path.exists(tls_dict['database_dir'])
    assert os.path.exists(tls_dict['certs_dir'])
Example #2
0
def test_create_ca_supporting_files(tmpdir):
    config = _get_config()
    tls_dict = mount_efs.tls_paths_dictionary(MOUNT_NAME, str(tmpdir))
    index = tls_dict['index']
    index_attr = tls_dict['index_attr']
    serial = tls_dict['serial']
    rand = tls_dict['rand']

    mount_efs.ca_dirs_check(config, tls_dict['database_dir'], tls_dict['certs_dir'])
    mount_efs.ca_supporting_files_check(index, index_attr, serial, rand)
    with open(index_attr, 'r') as index_attr_file:
        index_attr_content = index_attr_file.read()
    with open(serial, 'r') as serial_file:
        serial_content = serial_file.read()

    assert os.path.exists(index)
    assert os.path.exists(index_attr)
    assert os.path.exists(serial)
    assert os.path.exists(rand)

    assert 'unique_subject = no' == index_attr_content
    assert '00' == serial_content
def test_create_ca_supporting_files(tmpdir):
    config = _get_config()
    tls_dict = mount_efs.tls_paths_dictionary(MOUNT_NAME, str(tmpdir))
    index = tls_dict["index"]
    index_attr = tls_dict["index_attr"]
    serial = tls_dict["serial"]
    rand = tls_dict["rand"]

    mount_efs.ca_dirs_check(config, tls_dict["database_dir"],
                            tls_dict["certs_dir"])
    mount_efs.ca_supporting_files_check(index, index_attr, serial, rand)
    with open(index_attr, "r") as index_attr_file:
        index_attr_content = index_attr_file.read()
    with open(serial, "r") as serial_file:
        serial_content = serial_file.read()

    assert os.path.exists(index)
    assert os.path.exists(index_attr)
    assert os.path.exists(serial)
    assert os.path.exists(rand)

    assert "unique_subject = no" == index_attr_content
    assert "00" == serial_content