annotate profilemanager/tests/test_profilemanager.txt @ 30:d9886a7e8df7

return the full directory path
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 May 2010 16:53:33 -0700
parents d4f0c1c4d0eb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 Test ProfileManager
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 ===================
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 The obligatory imports:
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 >>> import os
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 >>> from profilemanager import ProfileManager
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 Get the path to the test profiles.ini file:
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
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
a07e53273b70 adding stubs for tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
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
a8601c2273b5 * hopefully fix tests
Jeff Hammel <jhammel@mozilla.com>
parents: 19
diff changeset
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
a8601c2273b5 * hopefully fix tests
Jeff Hammel <jhammel@mozilla.com>
parents: 19
diff changeset
38 >>> profiledir
a8601c2273b5 * hopefully fix tests
Jeff Hammel <jhammel@mozilla.com>
parents: 19
diff changeset
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')