add tests
This commit is contained in:
parent
f9acc7d6f8
commit
ae8910830c
16 changed files with 275 additions and 0 deletions
|
@ -0,0 +1,27 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<services>
|
||||
<service name="test">
|
||||
<file filelist="condition">/etc/file</file>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="condition" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif2" type="boolean" description="No change"/>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<condition name="disabled_if_in" source="condition">
|
||||
<param>oui</param>
|
||||
<target type="variable">mode_conteneur_actif</target>
|
||||
<target type="variable">mode_conteneur_actif2</target>
|
||||
<target type="filelist">condition</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
non
|
|
@ -0,0 +1,2 @@
|
|||
C /etc/file 0644 root root - /usr/local/lib/etc/file
|
||||
z /etc/file - - - - -
|
|
@ -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])
|
|
@ -0,0 +1 @@
|
|||
%%condition
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<services>
|
||||
<service name="test">
|
||||
<file filelist="pouet">/etc/file</file>
|
||||
</service>
|
||||
</services>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="condition" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif1" type="string" description="No change" hidden="True">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif2" type="string" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
<constraints>
|
||||
<condition name="disabled_if_in" source="condition">
|
||||
<param>oui</param>
|
||||
<target type="variable">mode_conteneur_actif1</target>
|
||||
<target type="variable">mode_conteneur_actif2</target>
|
||||
<target type="filelist">pouet</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="condition" redefine="True" remove_condition="True"/>
|
||||
</family>
|
||||
</variables>
|
||||
</rougail>
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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])
|
Loading…
Reference in a new issue