Mercurial > mozilla > hg > ProfileManager
comparison profilemanager/tests/test_profilemanager.txt @ 27:5988a15da3b4
things are being awful; checking in anyway
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 06 May 2010 16:47:12 -0700 |
parents | a8601c2273b5 |
children | d4f0c1c4d0eb |
comparison
equal
deleted
inserted
replaced
26:d260de170cca | 27:5988a15da3b4 |
---|---|
7 >>> from profilemanager import ProfileManager | 7 >>> from profilemanager import ProfileManager |
8 | 8 |
9 Get the path to the test profiles.ini file: | 9 Get the path to the test profiles.ini file: |
10 | 10 |
11 >>> from pkg_resources import resource_filename | 11 >>> from pkg_resources import resource_filename |
12 >>> path = os.path.join('tests', 'profiles', 'profiles.ini') | 12 >>> profiles_dir = os.path.join('test', 'profiles') |
13 >>> path = os.path.join(profiles_dir, 'profiles.ini') | |
13 >>> profiles = resource_filename('profilemanager', path) | 14 >>> profiles = resource_filename('profilemanager', path) |
15 >>> print profiles | |
16 >>> profiles_dir = resource_filename('profilemanager', profiles_dir) | |
17 >>> os.path.exists(profiles) | |
18 True | |
19 >>> os.path.exists(profiles_dir) | |
20 True | |
14 | 21 |
15 Instatiate a ProfileManager: | 22 Instatiate a ProfileManager: |
16 | 23 |
17 >>> manager = ProfileManager(profiles) | 24 >>> manager = ProfileManager(profiles) |
18 | 25 |
19 (I should delete any existing profiles at this point, but instead I'll | 26 Remove any profiles that didn't get cleaned up: |
20 defer this to later.) | 27 |
28 >>> profiles_dict = manager.profiles_dict() | |
29 >>> for profile in profiles_dict: | |
30 ... manager.remove(profile) | |
31 >>> os.listdir(profiles_dir) | |
32 ['profiles.ini'] | |
33 >>> file(profiles).read().strip() | |
34 '[General]' | |
21 | 35 |
22 Create a new profile: | 36 Create a new profile: |
23 | 37 |
24 >>> profiledir = manager.new('testprofile') | 38 >>> profiledir = manager.new('testprofile') |
25 >>> profiledir | 39 >>> profiledir |