diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_same_name/00-base.xml new file mode 100644 index 000000000..11c6f4882 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/00-base.xml @@ -0,0 +1,27 @@ + + + + + /etc/file + + + + + + non + + + non + + + + + + + oui + mode_conteneur_actif + mode_conteneur_actif2 + condition + + + diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/__init__.py b/tests/dictionaries/11disabled_if_in_filelist_same_name/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/after.json b/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/after.json new file mode 100644 index 000000000..14937b25a --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/after.json @@ -0,0 +1,30 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": true + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/base.json new file mode 100644 index 000000000..05d18c188 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/base.json @@ -0,0 +1,9 @@ +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": true, + "services.test.files.file.name": "/etc/file", + "services.test.files.file.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/before.json b/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/before.json new file mode 100644 index 000000000..14937b25a --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/makedict/before.json @@ -0,0 +1,30 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": true + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/result/etc/file b/tests/dictionaries/11disabled_if_in_filelist_same_name/result/etc/file new file mode 100644 index 000000000..d907505b5 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/result/etc/file @@ -0,0 +1 @@ +non diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/result/tmpfiles.d/0rougail.conf b/tests/dictionaries/11disabled_if_in_filelist_same_name/result/tmpfiles.d/0rougail.conf new file mode 100644 index 000000000..574c7b823 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/result/tmpfiles.d/0rougail.conf @@ -0,0 +1,2 @@ +C /etc/file 0644 root root - /usr/local/lib/etc/file +z /etc/file - - - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_same_name/tiramisu/base.py new file mode 100644 index 000000000..8da62c74f --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/tiramisu/base.py @@ -0,0 +1,28 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_5 = BoolOption(name="mode_conteneur_actif2", doc="No change", default=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = FilenameOption(name="name", doc="name", default="/etc/file") +option_11 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("oui")}))) +option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11]) +option_9.impl_set_information('source', "file") +option_8 = OptionDescription(name="files", doc="files", children=[option_9]) +option_12 = BoolOption(name="activate", doc="activate", default=True) +option_13 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_12, option_13]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_same_name/tmpl/file b/tests/dictionaries/11disabled_if_in_filelist_same_name/tmpl/file new file mode 100644 index 000000000..5113d9aae --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_same_name/tmpl/file @@ -0,0 +1 @@ +%%condition diff --git a/tests/dictionaries/51redefine_remove_condition_filelist/00-base.xml b/tests/dictionaries/51redefine_remove_condition_filelist/00-base.xml new file mode 100644 index 000000000..da7068dbd --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition_filelist/00-base.xml @@ -0,0 +1,32 @@ + + + + + /etc/file + + + + + + non + + + non + + + + non + + + + + + oui + mode_conteneur_actif1 + mode_conteneur_actif2 + pouet + + + diff --git a/tests/dictionaries/51redefine_remove_condition_filelist/01-base.xml b/tests/dictionaries/51redefine_remove_condition_filelist/01-base.xml new file mode 100644 index 000000000..a7251ff57 --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition_filelist/01-base.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/dictionaries/51redefine_remove_condition_filelist/__init__.py b/tests/dictionaries/51redefine_remove_condition_filelist/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/dictionaries/51redefine_remove_condition_filelist/makedict/after.json b/tests/dictionaries/51redefine_remove_condition_filelist/makedict/after.json new file mode 100644 index 000000000..f1d0883ae --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition_filelist/makedict/after.json @@ -0,0 +1,34 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/51redefine_remove_condition_filelist/makedict/base.json b/tests/dictionaries/51redefine_remove_condition_filelist/makedict/base.json new file mode 100644 index 000000000..b78a39dc6 --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition_filelist/makedict/base.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.name": "/etc/file", + "services.test.files.file.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/51redefine_remove_condition_filelist/makedict/before.json b/tests/dictionaries/51redefine_remove_condition_filelist/makedict/before.json new file mode 100644 index 000000000..f1d0883ae --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition_filelist/makedict/before.json @@ -0,0 +1,34 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/51redefine_remove_condition_filelist/tiramisu/base.py b/tests/dictionaries/51redefine_remove_condition_filelist/tiramisu/base.py new file mode 100644 index 000000000..7025e0acb --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition_filelist/tiramisu/base.py @@ -0,0 +1,29 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_6 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_11 = FilenameOption(name="name", doc="name", default="/etc/file") +option_12 = BoolOption(name="activate", doc="activate", default=True) +option_10 = OptionDescription(name="file", doc="file", children=[option_11, option_12]) +option_10.impl_set_information('source', "file") +option_9 = OptionDescription(name="files", doc="files", children=[option_10]) +option_13 = BoolOption(name="activate", doc="activate", default=True) +option_14 = BoolOption(name="manage", doc="manage", default=True) +option_8 = OptionDescription(name="test", doc="test", children=[option_9, option_13, option_14]) +option_7 = OptionDescription(name="services", doc="services", children=[option_8], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_7])