Mercurial > mozilla > hg > ProfileManager
comparison profilemanager/tests/test.py @ 34:5a27ad649768
more verbose asserts
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 06 May 2010 17:44:54 -0700 |
parents | 6f2ad307fdda |
children | b9d7f5f61e23 |
comparison
equal
deleted
inserted
replaced
33:7b2da536bc6c | 34:5a27ad649768 |
---|---|
7 from pkg_resources import resource_filename | 7 from pkg_resources import resource_filename |
8 profiles_dir = os.path.join('tests', 'profiles') | 8 profiles_dir = os.path.join('tests', 'profiles') |
9 path = os.path.join(profiles_dir, 'profiles.ini') | 9 path = os.path.join(profiles_dir, 'profiles.ini') |
10 profiles = resource_filename('profilemanager', path) | 10 profiles = resource_filename('profilemanager', path) |
11 profiles_dir = resource_filename('profilemanager', profiles_dir) | 11 profiles_dir = resource_filename('profilemanager', profiles_dir) |
12 assert os.path.exists(profiles) | 12 assert os.path.exists(profiles), '%s does not exist' % profiles |
13 assert os.path.exists(profiles_dir) | 13 assert os.path.exists(profiles_dir), '%s does not exist' % profiles_dir |
14 | 14 |
15 # Instatiate a ProfileManager: | 15 # Instatiate a ProfileManager: |
16 manager = ProfileManager(profiles) | 16 manager = ProfileManager(profiles) |
17 | 17 |
18 # Remove any profiles that didn't get cleaned up: | 18 # Remove any profiles that didn't get cleaned up: |
19 profiles_dict = manager.profiles_dict() | 19 profiles_dict = manager.profiles_dict() |
20 for profile in profiles_dict: | 20 for profile in profiles_dict: |
21 manager.remove(profile) | 21 manager.remove(profile) |
22 assert os.listdir(profiles_dir) == ['profiles.ini'] | 22 assert os.listdir(profiles_dir) == ['profiles.ini'], 'profiles_dir isnt empty except profiles.ini' |
23 assert file(profiles).read().strip() == '[General]' | 23 assert file(profiles).read().strip() == '[General]', 'profiles.ini isnt nearly empty' |
24 | 24 |
25 # Create a new profile: | 25 # Create a new profile: |
26 profiledir = manager.new('testprofile') | 26 profiledir = manager.new('testprofile') |
27 assert profiledir.endswith('.testprofile') | 27 assert profiledir.endswith('.testprofile'), 'profiledir should end with testprofile, instead it is %s' % profiledir) |
28 | 28 |
29 # Cleanup: | 29 # Cleanup: |
30 manager.remove('testprofile') | 30 manager.remove('testprofile') |