forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_navigation.py
More file actions
31 lines (24 loc) · 1.01 KB
/
test_navigation.py
File metadata and controls
31 lines (24 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unittest
from time import sleep
from util import ExtensionTestCase
kittens_url = 'http://freerangekitten.com/'
http_url = 'http://http.badssl.com/'
class TestNavigation(ExtensionTestCase):
def test_redirect(self):
sleep(3)
self.driver.get(kittens_url)
self.assertTrue(self.driver.current_url.startswith('https'))
def test_no_redirect_when_disabled(self):
self.toggle_disabled()
self.driver.get(kittens_url)
self.assertEqual(self.driver.current_url, kittens_url) # not https
def test_httpnowhere_blocks(self):
# if self.shim.browser_type == 'firefox':
# raise unittest.SkipTest('broken on firefox')
href_script = 'return window.location.href;'
self.driver.get(http_url)
self.toggle_http_nowhere()
self.assertFalse(http_url == self.driver.execute_script(href_script))
def test_http_site_not_blocked(self):
self.driver.get(http_url)
self.assertTrue(self.driver.current_url == http_url)