예제 #1
0
def test_write_stunnel_config_with_debug(mocker, tmpdir):
    ca_mocker = mocker.patch("mount_efs.add_stunnel_ca_options")
    state_file_dir = str(tmpdir)

    config_file = mount_efs.write_stunnel_config_file(
        _get_config(mocker, stunnel_debug_enabled=True),
        state_file_dir,
        FS_ID,
        MOUNT_POINT,
        PORT,
        DNS_NAME,
        VERIFY_LEVEL,
        OCSP_ENABLED,
        _get_mount_options(),
        DEFAULT_REGION,
    )
    utils.assert_called_once(ca_mocker)

    expected_global_config = dict(mount_efs.STUNNEL_GLOBAL_CONFIG)
    expected_global_config["debug"] = "debug"
    expected_global_config["output"] = os.path.join(
        mount_efs.LOG_DIR,
        "%s.stunnel.log"
        % mount_efs.get_mount_specific_filename(FS_ID, MOUNT_POINT, PORT),
    )

    _validate_config(config_file, expected_global_config, _get_expected_efs_config())
예제 #2
0
def test_write_stunnel_config_with_debug(mocker, tmpdir):
    ca_mocker = mocker.patch('mount_efs.add_stunnel_ca_options')
    state_file_dir = str(tmpdir)

    config_file = mount_efs.write_stunnel_config_file(
        _get_config(mocker, stunnel_debug_enabled=True), state_file_dir, FS_ID,
        MOUNT_POINT, PORT, DNS_NAME, VERIFY_LEVEL)
    ca_mocker.assert_called_once()

    expected_global_config = dict(mount_efs.STUNNEL_GLOBAL_CONFIG)
    expected_global_config['debug'] = 'debug'
    expected_global_config['output'] = os.path.join(
        mount_efs.LOG_DIR, '%s.stunnel.log' %
        mount_efs.get_mount_specific_filename(FS_ID, MOUNT_POINT, PORT))

    _validate_config(config_file, expected_global_config,
                     _get_expected_efs_config())