コード例 #1
0
def test_computed_string_replacement(examples):
    """a jail instance can provide additional values computed from
    configuration values."""
    target_dir, fs_examples = examples
    jail = DummyJail(ip_addr='192.168.0.1', fs_local_root=path.join(fs_examples, 'unbound'))
    fs_rendered = render_site_structure(jail.fs_local_root, jail, target_dir)
    fs_unbound_conf = path.join(fs_rendered, 'usr/local/etc/unbound/unbound.conf')
    # eventhough we didn't provide it in the config explicitly, the
    # access control has been computed from the ip_addr and rendered:
    assert ('access-control: 192.168.0.1/16 allow' in open(fs_unbound_conf).read())
コード例 #2
0
def test_subdirectories_created(examples):
    target_dir, fs_examples = examples
    fs_rendered = render_site_structure(path.join(fs_examples, 'unbound'),
        dict(ip_addr='192.168.0.1', access_control='10.0.1.0/16 allow'), target_dir)
    assert path.exists('%s/%s' % (fs_rendered, '/usr/local/etc'))
コード例 #3
0
def test_string_replacement(examples):
    target_dir, fs_examples = examples
    fs_rendered = render_site_structure(path.join(fs_examples, 'unbound'),
        dict(ip_addr='192.168.0.1', access_control='10.0.1.0/16 allow'), target_dir)
    fs_unbound_conf = path.join(fs_rendered, 'usr/local/etc/unbound/unbound.conf')
    assert ('interface: 192.168.0.1' in open(fs_unbound_conf).read())
コード例 #4
0
def test_tempdir_created(examples):
    target_dir, fs_examples = examples
    fs_rendered = render_site_structure(path.join(fs_examples, 'unbound'),
        dict(ip_addr='192.168.0.1', access_control='10.0.1.0/16 allow'), target_dir)
    assert fs_rendered != path.join(fs_examples, 'unbound')