Exemplo n.º 1
0
def test_exclude_path_with_old_setting():
    # TODO(#63): remove deprecated `skip_validation` setting in v2.0.
    paths = [r'/foo/', r'/bar/']
    assert_eq_regex_lists(
        get_exclude_paths(
            Mock(settings={'pyramid_swagger.skip_validation': paths})),
        [re.compile(r) for r in paths])
Exemplo n.º 2
0
def test_exclude_path_with_string():
    path_string = r'/foo/'
    registry = Mock(settings={'pyramid_swagger.exclude_paths': path_string})
    assert_eq_regex_lists(
        get_exclude_paths(registry),
        [re.compile(r) for r in [path_string]]
    )
Exemplo n.º 3
0
def test_exclude_path_with_old_setting():
    # TODO(#63): remove deprecated `skip_validation` setting in v2.0.
    paths = [r'/foo/', r'/bar/']
    assert_eq_regex_lists(
        get_exclude_paths(
            Mock(settings={'pyramid_swagger.skip_validation': paths})),
        [re.compile(r) for r in paths]
    )
Exemplo n.º 4
0
def test_exclude_path_with_overrides():
    paths = [r'/foo/', r'/bar/']
    compiled = get_exclude_paths(
        Mock(settings={'pyramid_swagger.exclude_paths': paths}))
    assert_eq_regex_lists(
        compiled,
        [re.compile(r) for r in paths]
    )
Exemplo n.º 5
0
def test_default_exclude_paths():
    assert_eq_regex_lists(get_exclude_paths(Mock(settings={})),
                          [re.compile(r) for r in DEFAULT_EXCLUDED_PATHS])
Exemplo n.º 6
0
def test_exclude_path_with_overrides():
    paths = [r'/foo/', r'/bar/']
    assert get_exclude_paths(
        Mock(settings={'pyramid_swagger.exclude_paths': paths})) \
        == [re.compile(r) for r in paths]
Exemplo n.º 7
0
def test_default_exclude_paths():
    assert_eq_regex_lists(
        get_exclude_paths(Mock(settings={})),
        [re.compile(r) for r in DEFAULT_EXCLUDED_PATHS]
    )
Exemplo n.º 8
0
def test_exclude_path_with_string():
    path_string = r'/foo/'
    assert get_exclude_paths(
        Mock(settings={'pyramid_swagger.exclude_paths': path_string})) \
        == [re.compile(r) for r in [path_string]]
Exemplo n.º 9
0
def test_default_exclude_paths():
    assert get_exclude_paths(Mock(settings={})) \
        == [re.compile(r) for r in DEFAULT_EXCLUDED_PATHS]
Exemplo n.º 10
0
def test_exclude_path_with_overrides():
    paths = [r'/foo/', r'/bar/']
    assert get_exclude_paths(
        Mock(settings={'pyramid_swagger.exclude_paths': paths})) \
        == [re.compile(r) for r in paths]
Exemplo n.º 11
0
def test_exclude_path_with_string():
    path_string = r'/foo/'
    assert get_exclude_paths(
        Mock(settings={'pyramid_swagger.exclude_paths': path_string})) \
        == [re.compile(r) for r in [path_string]]
Exemplo n.º 12
0
def test_default_exclude_paths():
    assert get_exclude_paths(Mock(settings={})) \
        == [re.compile(r) for r in DEFAULT_EXCLUDED_PATHS]