~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to testing/mozbase/mozprofile/tests/test_nonce.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
"""
4
 
test nonce in prefs delimeters
5
 
see https://bugzilla.mozilla.org/show_bug.cgi?id=722804
6
 
"""
7
 
 
8
 
import os
9
 
import tempfile
10
 
import time
11
 
import unittest
12
 
from mozprofile.prefs import Preferences
13
 
from mozprofile.profile import Profile
14
 
 
15
 
class PreferencesNonceTest(unittest.TestCase):
16
 
 
17
 
    def test_nonce(self):
18
 
 
19
 
        # make a profile with one preference
20
 
        path = tempfile.mktemp()
21
 
        profile = Profile(path,
22
 
                          preferences={'foo': 'bar'},
23
 
                          restore=False)
24
 
        user_js = os.path.join(profile.profile, 'user.js')
25
 
        self.assertTrue(os.path.exists(user_js))
26
 
 
27
 
        # ensure the preference is correct
28
 
        prefs = Preferences.read_prefs(user_js)
29
 
        self.assertEqual(dict(prefs), {'foo': 'bar'})
30
 
 
31
 
        del profile
32
 
 
33
 
        # augment the profile with a second preference
34
 
        profile = Profile(path,
35
 
                          preferences={'fleem': 'baz'},
36
 
                          restore=True)
37
 
        prefs = Preferences.read_prefs(user_js)
38
 
        self.assertEqual(dict(prefs), {'foo': 'bar', 'fleem': 'baz'})
39
 
 
40
 
        # cleanup the profile;
41
 
        # this should remove the new preferences but not the old
42
 
        profile.cleanup()
43
 
        prefs = Preferences.read_prefs(user_js)
44
 
        self.assertEqual(dict(prefs), {'foo': 'bar'})
45
 
 
46
 
if __name__ == '__main__':
47
 
    unittest.main()