comparison profilemanager/tests/test.py @ 73:1cfd259f74cf

finish dated backups, untested
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 May 2010 16:30:34 -0700
parents 619f5918b998
children b6bb59b79525
comparison
equal deleted inserted replaced
72:619f5918b998 73:1cfd259f74cf
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import os 3 import os
4 import time
4 from profilemanager import ProfileManager 5 from profilemanager import ProfileManager
5 6
6 # Get the path to the test profiles.ini file: 7 # Get the path to the test profiles.ini file:
7 from pkg_resources import resource_filename 8 from pkg_resources import resource_filename
8 profiles_dir = os.path.join('tests', 'profiles') 9 profiles_dir = os.path.join('tests', 'profiles')
41 manager.restore('testprofile', delete=True) 42 manager.restore('testprofile', delete=True)
42 backups = manager.backups('testprofile') 43 backups = manager.backups('testprofile')
43 assert not backups 44 assert not backups
44 # TODO: test the backup with a populated profile 45 # TODO: test the backup with a populated profile
45 46
47 # Test dated backups
48 manager.backup('testprofile')
49 old_backups = manager.backups('testprofile')[0]
50 old_time = int(time.time())
51 time.sleep(3)
52 manager.backup('testprofile')
53 # TODO: test with alternate forms of date
46 54
47 # Cleanup: 55 # Cleanup:
48 manager.remove('testprofile') 56 manager.remove('testprofile')
49 assert manager.list() == [] 57 assert manager.list() == []
50 f = file(profiles, 'w') 58 f = file(profiles, 'w')