rename API add_owner -> addowner
This commit is contained in:
parent
b341844450
commit
a894a5e27b
|
@ -7,7 +7,7 @@
|
|||
#from tiramisu.option import IntOption, OptionDescription
|
||||
#from tiramisu.error import ConfigError
|
||||
|
||||
#owners.add_owner('meta')
|
||||
#owners.addowner('meta')
|
||||
|
||||
|
||||
#def make_description():
|
||||
|
|
|
@ -40,13 +40,13 @@ def test_default_owner():
|
|||
assert cfg.getowner(gcdummy) == owners.user
|
||||
|
||||
|
||||
def test_add_owner():
|
||||
def test_addowner():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
cfg = Config(descr)
|
||||
assert cfg.dummy is False
|
||||
assert cfg.getowner(gcdummy) == 'default'
|
||||
owners.add_owner("gen_config")
|
||||
owners.addowner("gen_config")
|
||||
cfg.cfgimpl_get_settings().setowner(owners.gen_config)
|
||||
cfg.dummy = True
|
||||
assert cfg.getowner(gcdummy) == owners.gen_config
|
||||
|
@ -79,7 +79,7 @@ def test_setowner_for_value():
|
|||
cfg = Config(descr)
|
||||
assert cfg.dummy is False
|
||||
assert cfg.getowner(gcdummy) == 'default'
|
||||
owners.add_owner("new")
|
||||
owners.addowner("new")
|
||||
raises(ConfigError, "cfg.cfgimpl_get_values().setowner(gcdummy, owners.new)")
|
||||
cfg.dummy = False
|
||||
assert cfg.getowner(gcdummy) == owners.user
|
||||
|
|
|
@ -132,12 +132,12 @@ def populate_owners():
|
|||
setattr(owners, 'default', owners.DefaultOwner('default'))
|
||||
setattr(owners, 'user', owners.Owner('user'))
|
||||
|
||||
def add_owner(name):
|
||||
def addowner(name):
|
||||
"""
|
||||
:param name: the name of the new owner
|
||||
"""
|
||||
setattr(owners, name, owners.Owner(name))
|
||||
setattr(owners, 'add_owner', add_owner)
|
||||
setattr(owners, 'addowner', addowner)
|
||||
|
||||
# names are in the module now
|
||||
populate_owners()
|
||||
|
|
|
@ -37,7 +37,7 @@ class Values(Cache):
|
|||
try:
|
||||
getattr(owners, owner[0])
|
||||
except AttributeError:
|
||||
owners.add_owner(owner[0])
|
||||
owners.addowner(owner[0])
|
||||
|
||||
# sqlite
|
||||
def _sqlite_select(self, path):
|
||||
|
@ -112,5 +112,5 @@ class Values(Cache):
|
|||
try:
|
||||
return getattr(owners, owner)
|
||||
except AttributeError:
|
||||
owners.add_owner(owner)
|
||||
owners.addowner(owner)
|
||||
return getattr(owners, owner)
|
||||
|
|
Loading…
Reference in New Issue