4
test nonce in prefs delimeters
5
see https://bugzilla.mozilla.org/show_bug.cgi?id=722804
12
from mozprofile.prefs import Preferences
13
from mozprofile.profile import Profile
15
class PreferencesNonceTest(unittest.TestCase):
19
# make a profile with one preference
20
path = tempfile.mktemp()
21
profile = Profile(path,
22
preferences={'foo': 'bar'},
24
user_js = os.path.join(profile.profile, 'user.js')
25
self.assertTrue(os.path.exists(user_js))
27
# ensure the preference is correct
28
prefs = Preferences.read_prefs(user_js)
29
self.assertEqual(dict(prefs), {'foo': 'bar'})
33
# augment the profile with a second preference
34
profile = Profile(path,
35
preferences={'fleem': 'baz'},
37
prefs = Preferences.read_prefs(user_js)
38
self.assertEqual(dict(prefs), {'foo': 'bar', 'fleem': 'baz'})
40
# cleanup the profile;
41
# this should remove the new preferences but not the old
43
prefs = Preferences.read_prefs(user_js)
44
self.assertEqual(dict(prefs), {'foo': 'bar'})
46
if __name__ == '__main__':