How to use the prance.util.url.absurl function in prance

To help you get started, we’ve selected a few prance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jfinkhaeuser / prance / tests / test_util_url.py View on Github external
def test_absurl_paths_win32():
  base = 'c:\\windows\\notepad.exe'
  test = "regedit.exe"
  expect = 'file:///c:/windows/regedit.exe'

  with pytest.raises(url.ResolutionError):
    url.absurl(test)

  res = url.absurl(test, base)
  assert res.geturl() == expect
github jfinkhaeuser / prance / tests / test_util_url.py View on Github external
def test_absurl_paths_posix():
  base = '/etc/passwd'
  test = 'group'
  expect = 'file:///etc/group'

  with pytest.raises(url.ResolutionError):
    url.absurl(test)

  res = url.absurl(test, base)
  assert res.geturl() == expect
github jfinkhaeuser / prance / tests / test_util_url.py View on Github external
def test_absurl_fragment():
  base = 'file:///etc/passwd'
  test = '#frag'
  with pytest.raises(url.ResolutionError):
    url.absurl(test)

  res = url.absurl(test, base)
  assert res.geturl() == 'file:///etc/passwd#frag'
github jfinkhaeuser / prance / tests / test_util_url.py View on Github external
def test_absurl_relfile():
  base = 'http://foo.bar'
  test = 'relative.file'
  with pytest.raises(url.ResolutionError):
    url.absurl(test)
  with pytest.raises(url.ResolutionError):
    url.absurl(test, base)
github jfinkhaeuser / prance / tests / test_util_url.py View on Github external
def test_absurl_relfile():
  base = 'http://foo.bar'
  test = 'relative.file'
  with pytest.raises(url.ResolutionError):
    url.absurl(test)
  with pytest.raises(url.ResolutionError):
    url.absurl(test, base)