test_https-everywhere.py 1.02 KB
Newer Older
1
2
3
from marionette_driver import By
from marionette_driver.errors import MarionetteException

4
from marionette_harness import MarionetteTestCase
5
6
7
8

import testsuite


9
class Test(MarionetteTestCase):
10
11

    def setUp(self):
12
        MarionetteTestCase.setUp(self)
13
14
15
16
17
18
19
20
21
22

        ts = testsuite.TestSuite()
        self.ts = ts

        self.PREF_ENABLE_HE = "extensions.https_everywhere.globalEnabled"
        self.HTTP_URL = "http://www.freedomboxfoundation.org/thanks/"
        self.HTTPS_URL = "https://www.freedomboxfoundation.org/thanks/"


    def test_https_everywhere(self):
23
        self.assertEqual(self.marionette.get_pref(self.PREF_ENABLE_HE), \
24
25
26
27
28
29
30
31
32
33
                self.ts.t['test']['name'] == 'https-everywhere')

        with self.marionette.using_context('content'):
            self.marionette.navigate(self.HTTP_URL)

            if self.ts.t['test']['name'] == 'https-everywhere':
                self.assertEqual(self.marionette.get_url(), self.HTTPS_URL)
            else:
                self.assertEqual(self.marionette.get_url(), self.HTTP_URL)