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])
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]] )
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] )
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] )
def test_default_exclude_paths(): assert_eq_regex_lists(get_exclude_paths(Mock(settings={})), [re.compile(r) for r in DEFAULT_EXCLUDED_PATHS])
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]
def test_default_exclude_paths(): assert_eq_regex_lists( get_exclude_paths(Mock(settings={})), [re.compile(r) for r in DEFAULT_EXCLUDED_PATHS] )
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]]
def test_default_exclude_paths(): assert get_exclude_paths(Mock(settings={})) \ == [re.compile(r) for r in DEFAULT_EXCLUDED_PATHS]