Extent Config test coverage, and make del_profile() more robust
This commit is contained in:
parent
ddadf3486f
commit
62d5672a88
|
@ -44,6 +44,19 @@ Classes relating to configuration
|
||||||
{'foo': 'bar'}
|
{'foo': 'bar'}
|
||||||
>>> config.plugin_get('testplugin', 'foo')
|
>>> config.plugin_get('testplugin', 'foo')
|
||||||
'bar'
|
'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):
|
def del_profile(self, profile):
|
||||||
"""Delete a 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):
|
if self.base.profiles.has_key(profile):
|
||||||
del(self.base.profiles[profile])
|
del(self.base.profiles[profile])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue