Mercurial > mozilla > hg > ProfileManager
diff profilemanager/tests/test.py @ 74:b6bb59b79525
* return the backed-up profile
* further test restoring profiles
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 07 May 2010 17:09:32 -0700 |
parents | 1cfd259f74cf |
children | e76a122d8622 |
line wrap: on
line diff
--- a/profilemanager/tests/test.py Fri May 07 16:30:34 2010 -0700 +++ b/profilemanager/tests/test.py Fri May 07 17:09:32 2010 -0700 @@ -46,12 +46,26 @@ # Test dated backups manager.backup('testprofile') -old_backups = manager.backups('testprofile')[0] +old_backups = manager.backups('testprofile') +assert len(old_backups) == 1, "Expected one backup, instead got %d" % len(old_backups) old_time = int(time.time()) time.sleep(3) manager.backup('testprofile') +new_backups = manager.backups('testprofile') +assert len(new_backups) == 2, "Expected two backups, instead got %d" % len(new_backups) +restore_time = old_time + 1 +restored = manager.restore('testprofile', date=restore_time) +assert restored == old_backups[0], "Tried to restore from %d [%s], but got [%s]" % (restore_time, old_backups[0], restored) # TODO: test with alternate forms of date +# Restore the newest profile +restored = manager.restore('testprofile') +assert restored != old_backups[0], "Tried to restore the newest but got the old one" +manager.restore('testprofile', delete=True) +manager.restore('testprofile', delete=True) +assert not manager.backups() +assert manager.list() == ['testprofile'] + # Cleanup: manager.remove('testprofile') assert manager.list() == []