Beispiel #1
0
 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
Beispiel #2
0
 def test_get_root_url_local_url_with_port(self):
     self.assertEqual(get_root_url('http://localhost:9998/'),
                      'http://localhost:9998/')
Beispiel #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/')
Beispiel #4
0
 def test_get_root_url_local_url(self):
     self.assertEqual(get_root_url('http://localhost/'),
                      'http://localhost/')
Beispiel #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/')
Beispiel #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/')
Beispiel #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/')
Beispiel #8
0
 def test_get_root_url_remote_url(self):
     self.assertEqual(get_root_url('http://www.hoverstate.com/'),
                      'http://www.hoverstate.com/')
Beispiel #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/')
Beispiel #10
0
 def test_get_root_url_local_url_with_query(self):
     self.assertEqual(get_root_url('http://localhost/?favicon.ico'),
                      'http://localhost/')
Beispiel #11
0
 def test_get_root_url_local_url_with_fragment(self):
     self.assertEqual(get_root_url('http://localhost/#/form'),
                      'http://localhost/')