From 62d5672a889aa2b1f0e8549be1eb9721cbb8018f Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 14 Jan 2010 23:29:47 +0000 Subject: [PATCH] Extent Config test coverage, and make del_profile() more robust --- terminatorlib/config.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 6d714b23..60f911c4 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -44,7 +44,20 @@ Classes relating to configuration {'foo': 'bar'} >>> config.plugin_get('testplugin', 'foo') 'bar' ->>> +>>> config.get_profile() +'default' +>>> config.set_profile('my_first_new_testing_profile') +>>> config.get_profile() +'my_first_new_testing_profile' +>>> config.del_profile('my_first_new_testing_profile') +>>> config.get_profile() +'default' +>>> config.list_profiles().__class__.__name__ +'list' +>>> config.options_set({}) +>>> config.options_get() +{} +>>> """ @@ -220,6 +233,9 @@ class Config(object): def del_profile(self, profile): """Delete a profile""" + if profile == self.profile: + err('Config::del_profile: Deleting in-use profile %s.' % profile) + self.set_profile('default') if self.base.profiles.has_key(profile): del(self.base.profiles[profile])