Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
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'
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)
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)