tests on group types
This commit is contained in:
parent
0db34bbeba
commit
7784a82cde
2 changed files with 3 additions and 6 deletions
|
@ -23,7 +23,7 @@ def make_description():
|
||||||
|
|
||||||
master = OptionDescription('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
|
master = OptionDescription('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
|
||||||
interface1 = OptionDescription('interface1', '', [master])
|
interface1 = OptionDescription('interface1', '', [master])
|
||||||
interface1.set_group_type('group')
|
interface1.set_group_type('family')
|
||||||
|
|
||||||
general = OptionDescription('general', '', [numero_etab, nom_machine,
|
general = OptionDescription('general', '', [numero_etab, nom_machine,
|
||||||
nombre_interfaces, activer_proxy_client,
|
nombre_interfaces, activer_proxy_client,
|
||||||
|
@ -63,9 +63,6 @@ def test_iter_on_groups():
|
||||||
config = Config(descr)
|
config = Config(descr)
|
||||||
result = list(config.creole.iter_groups(group_type= "family"))
|
result = list(config.creole.iter_groups(group_type= "family"))
|
||||||
group_names = [res[0] for res in result]
|
group_names = [res[0] for res in result]
|
||||||
assert group_names == ['general']
|
|
||||||
result = list(config.creole.iter_groups())
|
|
||||||
group_names = [res[0] for res in result]
|
|
||||||
assert group_names == ['general', 'interface1']
|
assert group_names == ['general', 'interface1']
|
||||||
|
|
||||||
def test_iter_on_empty_group():
|
def test_iter_on_empty_group():
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Config(object):
|
||||||
if child._name not in self._cfgimpl_values:
|
if child._name not in self._cfgimpl_values:
|
||||||
if child.is_multi():
|
if child.is_multi():
|
||||||
self._cfgimpl_values[child._name] = Multi(
|
self._cfgimpl_values[child._name] = Multi(
|
||||||
copy(child.getdefault()), config=self, child=child)
|
copy(child.getdefault()), config=self, opt=child)
|
||||||
else:
|
else:
|
||||||
self._cfgimpl_values[child._name] = copy(child.getdefault())
|
self._cfgimpl_values[child._name] = copy(child.getdefault())
|
||||||
child.setowner(self, 'default')
|
child.setowner(self, 'default')
|
||||||
|
@ -426,7 +426,7 @@ class Config(object):
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
"Config comparison"
|
"Config comparison"
|
||||||
if not isinstance(other, OptionDescription):
|
if not isinstance(other, Config):
|
||||||
return False
|
return False
|
||||||
return self.getkey() == other.getkey()
|
return self.getkey() == other.getkey()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue