def test_starts_without_slash(self): # # TODO: This is a bug! # # Removing the SkipTest will show that the test is matching # /def/123.html instead of the expected abd/def/123.html # # The regular expression matches start with / # matches = RELATIVE_URL_RE.findall('abc/def/123.html') self.assertEqual(matches[0][0], 'abc/def/123.html')
def test_relative(self): matches = RELATIVE_URL_RE.findall('../../foobar/uploads/bar.html') self.assertEqual(matches[0][0], '/../foobar/uploads/bar.html')
def test_two_slashes(self): # This is filtered by ReExtract._filter_false_urls matches = RELATIVE_URL_RE.findall('//foo.123.html') self.assertEqual(matches[0][0], '//foo.123.html')
def test_with_padding(self): matches = RELATIVE_URL_RE.findall('123 /abc/def/123.html 456') self.assertEqual(matches[0][0], '/abc/def/123.html')
def test_no_match_2(self): matches = RELATIVE_URL_RE.findall('abc.html') self.assertEqual(matches, [])
def test_simple_filename(self): matches = RELATIVE_URL_RE.findall('/abc.html') self.assertEqual(matches[0][0], '/abc.html')
def test_no_match_1(self): matches = RELATIVE_URL_RE.findall('/abc') self.assertEqual(matches, [])
def test_with_fake_start(self): matches = RELATIVE_URL_RE.findall('</abc> /def.html') self.assertEqual(matches[0][0], '/def.html')
def test_full_url(self): # This is filtered by ReExtract._filter_false_urls matches = RELATIVE_URL_RE.findall('http://w3af.org/foo.html') self.assertEqual(matches[0][0], '://w3af.org/foo.html')
def test_path_query_string_multi(self): matches = RELATIVE_URL_RE.findall('/abc/foo.html?id=1&foo=1') self.assertEqual(matches[0][0], '/abc/foo.html?id=1&foo=1')
def test_query_string(self): matches = RELATIVE_URL_RE.findall('/foo.html?id=1') self.assertEqual(matches[0][0], '/foo.html?id=1')