From 42fc21e6f51a424332e80bb2f0ca6cc255f9663d Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 6 Apr 2018 08:30:32 +0200 Subject: [PATCH] update access to property or permissive in tests --- test/test_option_setting.py | 12 ++++++------ test/test_option_type.py | 14 +++++++------- test/test_parsing_group.py | 8 ++++---- test/test_permissive.py | 22 +++++++++++----------- test/test_requires.py | 10 +++++----- test/test_submulti.py | 4 ++-- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/test/test_option_setting.py b/test/test_option_setting.py index 49b8084..9993e06 100644 --- a/test/test_option_setting.py +++ b/test/test_option_setting.py @@ -143,7 +143,7 @@ def test_multi_with_requires(): assert not 'hidden' in api.option('str').property.get() api.option('int').value.set(1) raises(PropertiesOptionError, "api.option('str').value.set(['a', 'b'])") - assert 'hidden' in api.option('str').property.get() + assert 'hidden' in api.forcepermissive.option('str').property.get() def test__requires_with_inverted(): @@ -170,7 +170,7 @@ def test_multi_with_requires_in_another_group(): assert not 'hidden' in api.option('opt.str').property.get() api.option('int').value.set(1) raises(PropertiesOptionError, "api.option('opt.str').value.set(['a', 'b'])") - assert 'hidden' in api.option('opt.str').property.get() + assert 'hidden' in api.forcepermissive.option('opt.str').property.get() def test_multi_with_requires_in_another_group_inverse(): @@ -185,7 +185,7 @@ def test_multi_with_requires_in_another_group_inverse(): assert not 'hidden' in api.option('opt.str').property.get() api.option('int').value.set(1) raises(PropertiesOptionError, "api.option('opt.str').value.set(['a', 'b'])") - assert 'hidden' in api.option('opt.str').property.get() + assert 'hidden' in api.forcepermissive.option('opt.str').property.get() def test_apply_requires_from_config(): @@ -200,7 +200,7 @@ def test_apply_requires_from_config(): assert not 'hidden' in api.option('opt.str').property.get() api.option('int').value.set(1) raises(PropertiesOptionError, "api.option('opt.str').value.get()") - assert 'hidden' in api.option('opt.str').property.get() + assert 'hidden' in api.forcepermissive.option('opt.str').property.get() def test_apply_requires_with_disabled(): @@ -215,7 +215,7 @@ def test_apply_requires_with_disabled(): assert not 'disabled' in api.option('opt.str').property.get() api.option('int').value.set(1) raises(PropertiesOptionError, "api.option('opt.str').value.get()") - assert 'disabled' in api.option('opt.str').property.get() + assert 'disabled' in api.unrestraint.option('opt.str').property.get() def test_multi_with_requires_with_disabled_in_another_group(): @@ -230,7 +230,7 @@ def test_multi_with_requires_with_disabled_in_another_group(): assert not 'disabled' in api.option('opt.str').property.get() api.option('int').value.set(1) raises(PropertiesOptionError, "api.option('opt.str').value.set(['a', 'b'])") - assert 'disabled' in api.option('opt.str').property.get() + assert 'disabled' in api.unrestraint.option('opt.str').property.get() def test_multi_with_requires_that_is_multi(): diff --git a/test/test_option_type.py b/test/test_option_type.py index c55c663..48867c7 100644 --- a/test/test_option_type.py +++ b/test/test_option_type.py @@ -44,7 +44,7 @@ def test_is_hidden(): descr = make_description() api = getapi(Config(descr)) api.property.read_write() - assert not 'frozen' in api.option('gc.dummy').property.get() + assert not 'frozen' in api.forcepermissive.option('gc.dummy').property.get() # setattr raises(PropertiesOptionError, "api.option('gc.dummy').value.get() == False") # getattr @@ -57,10 +57,10 @@ def test_group_is_hidden(): api.property.read_write() api.option('gc').property.add('hidden') raises(PropertiesOptionError, "api.option('gc.dummy').value.get()") - assert 'hidden' in api.option('gc').property.get() + assert 'hidden' in api.forcepermissive.option('gc').property.get() raises(PropertiesOptionError, "api.option('gc.float').value.get()") # manually set the subconfigs to "show" - api.option('gc').property.pop('hidden') + api.forcepermissive.option('gc').property.pop('hidden') assert not 'hidden' in api.option('gc').property.get() assert api.option('gc.float').value.get() == 2.3 #dummy est en hide @@ -78,14 +78,14 @@ def test_group_is_hidden_multi(): api.property.read_write() api.option('objspace').property.add('hidden') raises(PropertiesOptionError, "api.option('objspace').value.get()") - assert 'hidden' in api.option('objspace').property.get() + assert 'hidden' in api.forcepermissive.option('objspace').property.get() prop = [] try: api.option('objspace').value.set(['std']) except PropertiesOptionError as err: prop = err.proptype assert 'hidden' in prop - api.option('objspace').property.pop('hidden') + api.forcepermissive.option('objspace').property.pop('hidden') assert not 'hidden' in api.option('objspace').property.get() api.option('objspace').value.set(['std', 'std']) @@ -94,8 +94,8 @@ def test_global_show(): descr = make_description() api = getapi(Config(descr)) api.property.read_write() - api.option('gc.dummy').property.add('hidden') - assert 'hidden' in api.option('gc.dummy').property.get() + api.forcepermissive.option('gc.dummy').property.add('hidden') + assert 'hidden' in api.forcepermissive.option('gc.dummy').property.get() raises(PropertiesOptionError, "api.option('gc.dummy').value.get() == False") diff --git a/test/test_parsing_group.py b/test/test_parsing_group.py index 3d1a5ba..0d6c974 100644 --- a/test/test_parsing_group.py +++ b/test/test_parsing_group.py @@ -536,17 +536,17 @@ def test_values_with_master_disabled(): api.option('ip_admin_eth0.ip_admin_eth0').value.pop(0) #delete with value in disabled var - api.option('ip_admin_eth0.netmask_admin_eth0').property.pop('disabled') + api.unrestraint.option('ip_admin_eth0.netmask_admin_eth0').property.pop('disabled') api.option('ip_admin_eth0.ip_admin_eth0').value.set(["192.168.230.145"]) api.option('ip_admin_eth0.netmask_admin_eth0', 0).value.set("192.168.230.145") - api.option('ip_admin_eth0.netmask_admin_eth0').property.add('disabled') + api.unrestraint.option('ip_admin_eth0.netmask_admin_eth0').property.add('disabled') api.option('ip_admin_eth0.ip_admin_eth0').value.pop(0) #append with value in disabled var - api.option('ip_admin_eth0.netmask_admin_eth0').property.pop('disabled') + api.unrestraint.option('ip_admin_eth0.netmask_admin_eth0').property.pop('disabled') api.option('ip_admin_eth0.ip_admin_eth0').value.set(["192.168.230.145"]) api.option('ip_admin_eth0.netmask_admin_eth0', 0).value.set("192.168.230.145") - api.option('ip_admin_eth0.netmask_admin_eth0').property.add('disabled') + api.unrestraint.option('ip_admin_eth0.netmask_admin_eth0').property.add('disabled') api.option('ip_admin_eth0.ip_admin_eth0').value.set(["192.168.230.145", '192.168.230.43']) diff --git a/test/test_permissive.py b/test/test_permissive.py index e997ec3..fea0fef 100644 --- a/test/test_permissive.py +++ b/test/test_permissive.py @@ -26,7 +26,7 @@ def test_permissive(): except PropertiesOptionError as err: props = err.proptype assert set(props) == {'disabled'} - api.permissive.set(frozenset(['disabled'])) + api.unrestraint.permissive.set(frozenset(['disabled'])) props = frozenset() try: api.option('u1').value.get() @@ -57,7 +57,7 @@ def test_permissive_mandatory(): assert frozenset(props) == frozenset(['disabled', 'mandatory']) else: assert frozenset(props) == frozenset(['disabled']) - api.permissive.set(frozenset(['mandatory', 'disabled'])) + api.unrestraint.permissive.set(frozenset(['mandatory', 'disabled'])) api.property.add('permissive') api.option('u1').value.get() api.property.pop('permissive') @@ -75,7 +75,7 @@ def test_permissive_frozen(): descr = make_description() api = getapi(Config(descr)) api.property.read_write() - api.permissive.set(frozenset(['frozen', 'disabled'])) + api.unrestraint.permissive.set(frozenset(['frozen', 'disabled'])) try: api.option('u1').value.set(1) except PropertiesOptionError as err: @@ -103,7 +103,7 @@ if TIRAMISU_VERSION == 3: descr = make_description() api = getapi(Config(descr)) api.property.read_write() - raises(TypeError, "api.permissive.set(['frozen', 'disabled'])") + raises(TypeError, "api.unrestraint.permissive.set(['frozen', 'disabled'])") def test_permissive_option(): @@ -124,7 +124,7 @@ def test_permissive_option(): props = err.proptype assert set(props) == {'disabled'} - api.option('u1').permissive.set(frozenset(['disabled'])) + api.unrestraint.option('u1').permissive.set(frozenset(['disabled'])) props = frozenset() try: api.option('u1').value.get() @@ -180,7 +180,7 @@ def test_permissive_option_cache(): props = err.proptype assert set(props) == {'disabled'} - api.option('u1').permissive.set(frozenset(['disabled'])) + api.unrestraint.option('u1').permissive.set(frozenset(['disabled'])) props = frozenset() try: api.option('u1').value.get() @@ -231,7 +231,7 @@ def test_permissive_option_mandatory(): assert frozenset(props) == frozenset(['disabled', 'mandatory']) else: assert frozenset(props) == frozenset(['disabled']) - api.option('u1').permissive.set(frozenset(['mandatory', 'disabled'])) + api.unrestraint.option('u1').permissive.set(frozenset(['mandatory', 'disabled'])) api.property.add('permissive') api.option('u1').value.get() api.property.pop('permissive') @@ -249,7 +249,7 @@ def test_permissive_option_frozen(): descr = make_description() api = getapi(Config(descr)) api.property.read_write() - api.option('u1').permissive.set(frozenset(['frozen', 'disabled'])) + api.unrestraint.option('u1').permissive.set(frozenset(['frozen', 'disabled'])) api.option('u1').value.set(1) assert api.option('u1').value.get() == 1 api.property.add('permissive') @@ -263,7 +263,7 @@ if TIRAMISU_VERSION == 3: descr = make_description() api = getapi(Config(descr)) api.property.read_write() - raises(TypeError, "api.option('u1').permissive.set(['frozen', 'disabled'])") + raises(TypeError, "api.unrestraint.option('u1').permissive.set(['frozen', 'disabled'])") def test_remove_option_permissive(): @@ -273,7 +273,7 @@ def test_remove_option_permissive(): api = getapi(Config(rootod)) api.property.read_write() raises(PropertiesOptionError, "api.option('od1.var1').value.get()") - api.option('od1.var1').permissive.set(frozenset(['hidden'])) + api.forcepermissive.option('od1.var1').permissive.set(frozenset(['hidden'])) assert api.option('od1.var1').value.get() == 'value' - api.option('od1.var1').permissive.set(frozenset()) + api.forcepermissive.option('od1.var1').permissive.set(frozenset()) raises(PropertiesOptionError, "api.option('od1.var1').value.get()") diff --git a/test/test_requires.py b/test/test_requires.py index 9634cd4..5fefded 100644 --- a/test/test_requires.py +++ b/test/test_requires.py @@ -24,9 +24,9 @@ def test_properties(): except PropertiesOptionError as err: props = err.proptype assert frozenset(props) == frozenset(['disabled']) - api.option('ip_address_service').property.pop('disabled') + api.unrestraint.option('ip_address_service').property.pop('disabled') api.option('ip_address_service').value.get() - api.option('ip_address_service').property.add('disabled') + api.unrestraint.option('ip_address_service').property.add('disabled') props = [] try: api.option('ip_address_service').value.get() @@ -34,8 +34,8 @@ def test_properties(): props = err.proptype assert frozenset(props) == frozenset(['disabled']) # pop twice - api.option('ip_address_service').property.pop('disabled') - api.option('ip_address_service').property.pop('disabled') + api.unrestraint.option('ip_address_service').property.pop('disabled') + api.unrestraint.option('ip_address_service').property.pop('disabled') def test_requires(): @@ -797,7 +797,7 @@ def test_requires_requirement_append(): raises(ValueError, "api.option('ip_address_service').property.add('disabled')") api.option('activate_service').value.set(False) # disabled is now set, test to remove disabled before store in storage - api.option('ip_address_service').property.add("test") + api.unrestraint.option('ip_address_service').property.add("test") def test_requires_different_inverse(): diff --git a/test/test_submulti.py b/test/test_submulti.py index cdd1dde..383af47 100644 --- a/test/test_submulti.py +++ b/test/test_submulti.py @@ -331,10 +331,10 @@ def test_values_with_master_disabled_submulti(): api.option('ip_admin_eth0.ip_admin_eth0').value.pop(0) #delete with value in disabled var - api.option('ip_admin_eth0.netmask_admin_eth0').property.pop('disabled') + api.unrestraint.option('ip_admin_eth0.netmask_admin_eth0').property.pop('disabled') api.option('ip_admin_eth0.ip_admin_eth0').value.set(['192.168.230.145']) api.option('ip_admin_eth0.netmask_admin_eth0', 0).value.set(['192.168.230.145']) - api.option('ip_admin_eth0.netmask_admin_eth0').property.add('disabled') + api.unrestraint.option('ip_admin_eth0.netmask_admin_eth0').property.add('disabled') api.option('ip_admin_eth0.ip_admin_eth0').value.pop(0)