Пример #1
0
Файл: page.py Проект: Etiqa/eats
 def get_favicon_url(self):
     href = self.get_favicon_info()
     if href is None:
         return utils.get_root_url(self.current_url()) + "favicon.ico"
     url_obj = urlparse(href)
     if href.startwith('//'):
         url_obj = urlparse(self.current_url())
         return url_obj.scheme + href
     elif url_obj.scheme == '':
         return utils.get_root_url(self.current_url()) + href
Пример #2
0
 def test_get_root_url_local_url_with_port(self):
     self.assertEqual(get_root_url('http://localhost:9998/'),
                      'http://localhost:9998/')
Пример #3
0
 def test_get_root_url_remote_url_with_query_and_port(self):
     self.assertEqual(
         get_root_url('http://www.hoverstate.com:8080/?favicon.ico'),
         'http://www.hoverstate.com:8080/')
Пример #4
0
 def test_get_root_url_local_url(self):
     self.assertEqual(get_root_url('http://localhost/'),
                      'http://localhost/')
Пример #5
0
 def test_get_root_url_remote_url_with_fragment(self):
     self.assertEqual(get_root_url('http://www.hoverstate.com/#/form'),
                      'http://www.hoverstate.com/')
Пример #6
0
 def test_get_root_url_remote_url_with_path(self):
     self.assertEqual(get_root_url('http://www.hoverstate.com/favicon.ico'),
                      'http://www.hoverstate.com/')
Пример #7
0
 def test_get_root_url_remote_url_with_port(self):
     self.assertEqual(get_root_url('http://www.hoverstate.com:8080/'),
                      'http://www.hoverstate.com:8080/')
Пример #8
0
 def test_get_root_url_remote_url(self):
     self.assertEqual(get_root_url('http://www.hoverstate.com/'),
                      'http://www.hoverstate.com/')
Пример #9
0
 def test_get_root_url_local_url_with_query_and_port(self):
     self.assertEqual(get_root_url('http://localhost:9998/?favicon.ico'),
                      'http://localhost:9998/')
Пример #10
0
 def test_get_root_url_local_url_with_query(self):
     self.assertEqual(get_root_url('http://localhost/?favicon.ico'),
                      'http://localhost/')
Пример #11
0
 def test_get_root_url_local_url_with_fragment(self):
     self.assertEqual(get_root_url('http://localhost/#/form'),
                      'http://localhost/')