summaryrefslogtreecommitdiffstats
path: root/testing/marionette/harness/marionette_harness/tests/unit/test_profile_management.py
blob: f8ec952b27c8fec5bd92b5e8cc62543a229e6d23 (plain)
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
32
33
34
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from marionette_harness import MarionetteTestCase


class TestProfileManagement(MarionetteTestCase):

    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.marionette.enforce_gecko_prefs(
            {"marionette.test.bool": True,
             "marionette.test.string": "testing",
             "marionette.test.int": 3
             })
        self.marionette.set_context("chrome")

    def test_preferences_are_set(self):
        self.assertTrue(self.marionette.get_pref("marionette.test.bool"))
        self.assertEqual(self.marionette.get_pref("marionette.test.string"), "testing")
        self.assertEqual(self.marionette.get_pref("marionette.test.int"), 3)

    def test_change_preference(self):
        self.assertTrue(self.marionette.get_pref("marionette.test.bool"))

        self.marionette.enforce_gecko_prefs({"marionette.test.bool": False})

        self.assertFalse(self.marionette.get_pref("marionette.test.bool"))

    def test_clean_profile(self):
        self.marionette.restart(clean=True)

        self.assertEqual(self.marionette.get_pref("marionette.test.bool"), None)