Mercurial > mozilla > hg > ProfileManager
annotate profilemanager/tests/test_profilemanager.txt @ 29:105ecbac0928
fix some test failures
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 06 May 2010 16:51:21 -0700 |
parents | d4f0c1c4d0eb |
children |
rev | line source |
---|---|
12 | 1 Test ProfileManager |
2 =================== | |
3 | |
4 The obligatory imports: | |
5 | |
6 >>> import os | |
7 >>> from profilemanager import ProfileManager | |
8 | |
9 Get the path to the test profiles.ini file: | |
10 | |
11 >>> from pkg_resources import resource_filename | |
28
d4f0c1c4d0eb
all that fuss over a missing "s"
Jeff Hammel <jhammel@mozilla.com>
parents:
27
diff
changeset
|
12 >>> profiles_dir = os.path.join('tests', 'profiles') |
27
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
13 >>> path = os.path.join(profiles_dir, 'profiles.ini') |
12 | 14 >>> profiles = resource_filename('profilemanager', path) |
27
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
15 >>> profiles_dir = resource_filename('profilemanager', profiles_dir) |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
16 >>> os.path.exists(profiles) |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
17 True |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
18 >>> os.path.exists(profiles_dir) |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
19 True |
13
5f81f9d321ba
instantiate a profile manager in the tests with a stub profiles.ini file
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
20 |
5f81f9d321ba
instantiate a profile manager in the tests with a stub profiles.ini file
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
21 Instatiate a ProfileManager: |
5f81f9d321ba
instantiate a profile manager in the tests with a stub profiles.ini file
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
22 |
5f81f9d321ba
instantiate a profile manager in the tests with a stub profiles.ini file
Jeff Hammel <jhammel@mozilla.com>
parents:
12
diff
changeset
|
23 >>> manager = ProfileManager(profiles) |
14
e846544b4d92
stub for a test to create a new profile
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
24 |
27
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
25 Remove any profiles that didn't get cleaned up: |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
26 |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
27 >>> profiles_dict = manager.profiles_dict() |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
28 >>> for profile in profiles_dict: |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
29 ... manager.remove(profile) |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
30 >>> os.listdir(profiles_dir) |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
31 ['profiles.ini'] |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
32 >>> file(profiles).read().strip() |
5988a15da3b4
things are being awful; checking in anyway
Jeff Hammel <jhammel@mozilla.com>
parents:
23
diff
changeset
|
33 '[General]' |
23 | 34 |
14
e846544b4d92
stub for a test to create a new profile
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
35 Create a new profile: |
e846544b4d92
stub for a test to create a new profile
Jeff Hammel <jhammel@mozilla.com>
parents:
13
diff
changeset
|
36 |
19
4a1815f8d146
* stub adding new profile to configuration
Jeff Hammel <jhammel@mozilla.com>
parents:
14
diff
changeset
|
37 >>> profiledir = manager.new('testprofile') |
23 | 38 >>> profiledir |
39 '...profilemanager/tests/profiles/...testprofile' | |
19
4a1815f8d146
* stub adding new profile to configuration
Jeff Hammel <jhammel@mozilla.com>
parents:
14
diff
changeset
|
40 |
4a1815f8d146
* stub adding new profile to configuration
Jeff Hammel <jhammel@mozilla.com>
parents:
14
diff
changeset
|
41 Cleanup: |
4a1815f8d146
* stub adding new profile to configuration
Jeff Hammel <jhammel@mozilla.com>
parents:
14
diff
changeset
|
42 |
4a1815f8d146
* stub adding new profile to configuration
Jeff Hammel <jhammel@mozilla.com>
parents:
14
diff
changeset
|
43 >>> manager.remove('testprofile') |