def test_sanitize_literals(env, blacklist, whitelist):

    after = environment.sanitize(env, blacklist, whitelist)

    # Check that all the whitelisted variables are there
    assert all(x in after for x in whitelist)

    # Check that the blacklisted variables that are not
    # whitelisted are there
    blacklist = list(set(blacklist) - set(whitelist))
    assert all(x not in after for x in blacklist)
Пример #2
0
def test_sanitize_literals(env, exclude, include):

    after = environment.sanitize(env, exclude, include)

    # Check that all the included variables are there
    assert all(x in after for x in include)

    # Check that the excluded variables that are not
    # included are there
    exclude = list(set(exclude) - set(include))
    assert all(x not in after for x in exclude)
def test_sanitize_regex(env, blacklist, whitelist, expected, deleted):

    after = environment.sanitize(env, blacklist, whitelist)

    assert all(x in after for x in expected)
    assert all(x not in after for x in deleted)
Пример #4
0
def test_sanitize_regex(env, exclude, include, expected, deleted):

    after = environment.sanitize(env, exclude, include)

    assert all(x in after for x in expected)
    assert all(x not in after for x in deleted)