def test_set_extension(self): u = URL('https://www.w3af.com/xyz/foo') self.assertRaises(Exception, u.set_extension, 'xml') u = URL('https://w3af.com/xyz/d.html') u.set_extension('xml') self.assertEqual(u.get_extension(), 'xml') u = URL('https://w3af.com/xyz/d.html?id=3') u.set_extension('xml') self.assertEqual(u.get_extension(), 'xml') u = URL('https://w3af.com/xyz/d.html.foo?id=3') u.set_extension('xml') self.assertEqual(u.get_extension(), 'xml') self.assertEqual(u.url_string, u'https://w3af.com/xyz/d.html.xml?id=3')
def test_simplest_url(self): u = URL('http://w3af.com/foo/bar.txt') self.assertEqual(u.path, '/foo/bar.txt') self.assertEqual(u.scheme, 'http') self.assertEqual(u.get_file_name(), 'bar.txt') self.assertEqual(u.get_extension(), 'txt')
def test_simplest_url(self): u = URL('http://w3af.com/foo/bar.txt') self.assertEqual(u.path, '/foo/bar.txt') self.assertEqual(u.scheme, 'http') self.assertEqual(u.get_file_name(), 'bar.txt') self.assertEqual(u.get_extension(), 'txt')
def test_set_extension(self): u = URL('https://www.w3af.com/xyz/foo') self.assertRaises(Exception, u.set_extension, 'xml') u = URL('https://w3af.com/xyz/d.html') u.set_extension('xml') self.assertEqual(u.get_extension(), 'xml') u = URL('https://w3af.com/xyz/d.html?id=3') u.set_extension('xml') self.assertEqual(u.get_extension(), 'xml') u = URL('https://w3af.com/xyz/d.html.foo?id=3') u.set_extension('xml') self.assertEqual(u.get_extension(), 'xml') self.assertEqual(u.url_string, u'https://w3af.com/xyz/d.html.xml?id=3')