~ubuntu-branches/ubuntu/precise/enigmail/precise-security

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-11-12 16:36:01 UTC
  • mfrom: (0.12.15)
  • Revision ID: package-import@ubuntu.com-20121112163601-t8e8skdfi3ni9iqp
Tags: 2:1.4.6-0ubuntu0.12.04.1
* New upstream release v1.4.6
  - see LP: #1080212 for USN information
* Drop unneeded patches
  - remove debian/patches/correct-version-number.diff
  - remove debian/patches/dont_register_cids_multiple_times.diff
  - update debian/patches/series
* Support building in an objdir
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
import mozprofile
 
4
import os
 
5
import shutil
 
6
import tempfile
 
7
import unittest
 
8
 
 
9
here = os.path.dirname(os.path.abspath(__file__))
 
10
 
 
11
class Bug758250(unittest.TestCase):
 
12
    """
 
13
    use of --profile in mozrunner just blows away addon sources:
 
14
    https://bugzilla.mozilla.org/show_bug.cgi?id=758250
 
15
    """
 
16
 
 
17
    def test_profile_addon_cleanup(self):
 
18
 
 
19
        # sanity check: the empty addon should be here
 
20
        empty = os.path.join(here, 'empty')
 
21
        self.assertTrue(os.path.exists(empty))
 
22
        self.assertTrue(os.path.isdir(empty))
 
23
        self.assertTrue(os.path.exists(os.path.join(empty, 'install.rdf')))
 
24
 
 
25
        # because we are testing data loss, let's make sure we make a copy
 
26
        tmpdir = tempfile.mktemp()
 
27
        shutil.copytree(empty, tmpdir)
 
28
        self.assertTrue(os.path.exists(os.path.join(tmpdir, 'install.rdf')))
 
29
 
 
30
        # make a starter profile
 
31
        profile = mozprofile.FirefoxProfile()
 
32
        path = profile.profile
 
33
 
 
34
        # make a new profile based on the old
 
35
        newprofile = mozprofile.FirefoxProfile(profile=path, addons=[tmpdir])
 
36
        newprofile.cleanup()
 
37
 
 
38
        # the source addon *should* still exist
 
39
        self.assertTrue(os.path.exists(tmpdir))
 
40
        self.assertTrue(os.path.exists(os.path.join(tmpdir, 'install.rdf')))
 
41
 
 
42
        # remove vestiges
 
43
        shutil.rmtree(tmpdir)
 
44
 
 
45
if __name__ == '__main__':
 
46
    unittest.main()