Compare commits
43 Commits
release/3.
...
release/3.
Author | SHA1 | Date | |
---|---|---|---|
7c641961d3 | |||
4321bde399 | |||
c15dac8093 | |||
82a91db16e | |||
5ff47ac5c9 | |||
a9ca9fdb6a | |||
b6ec77aa23 | |||
2d7d237e19 | |||
113b7a3410 | |||
1691e38db5 | |||
c5ce9be699 | |||
613ae47573 | |||
fd18af62ca | |||
34d71901d0 | |||
35ef218c9c | |||
a33c7ed41e | |||
73d45f54cf | |||
69384a5e69 | |||
e73f3d1e47 | |||
d3eef77c03 | |||
fb1286e50e | |||
83f05197fb | |||
55da00f131 | |||
516a5a7219 | |||
620e8bbf2e | |||
4df36a5548 | |||
aa11e3b79c | |||
07e6ea5eb2 | |||
e7cbd7849a | |||
b9e9e98270 | |||
a774378732 | |||
5498a12b2b | |||
552cd3740d | |||
5ea35bf84e | |||
6d0d233d9b | |||
829247e79f | |||
63094f7e54 | |||
1aec891408 | |||
48b3b7e8a4 | |||
4dbb82ed3f | |||
97b75660c5 | |||
06f501ad05 | |||
2b45955886 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,5 +3,4 @@
|
||||
*.pyc
|
||||
*.mo
|
||||
*.swp
|
||||
version.in
|
||||
build/
|
||||
|
40
ChangeLog
40
ChangeLog
@ -1,4 +1,42 @@
|
||||
Sun Mar 24 20:24:34 2019
|
||||
Wed Aug 28 15:50:30 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc14
|
||||
* correction in metaconfig_prefix
|
||||
* correction in validation with parent
|
||||
|
||||
Mon Aug 21 14:24:42 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc12
|
||||
* prefix metaconfig_prefix with current name
|
||||
|
||||
Mon Aug 19 08:02:27 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc11
|
||||
* Config could have multiple parents
|
||||
* todict works with Metaconfig
|
||||
* separate Cache from values and settings
|
||||
|
||||
Fri Jul 26 09:43:03 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc9 and rc10
|
||||
* better todict support (especially for leadership
|
||||
* can add display_name method to Config init to change the name a
|
||||
option in errors
|
||||
|
||||
Mon Jun 5 14:49:27 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc7
|
||||
* retrieve metaconfig/mixconfig/config by name in a metaconfig/mixconfig
|
||||
* add new config with mixconfig type
|
||||
|
||||
Mon Apr 8 08:40:10 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc6
|
||||
* import tiramisu-json in tiramisu repository
|
||||
|
||||
Fri Apr 5 20:57:05 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc4 and rc5
|
||||
* change filename/directory name with Python Packaging Autority
|
||||
recommendations
|
||||
* do not change Config contexts properties when reload in MetaConfig
|
||||
(fixes #7)
|
||||
* add/remove config in mixconfig or metaconfig (fixes #6)
|
||||
|
||||
Sun Mar 24 20:24:34 2019 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* version 3.0 rc3
|
||||
* corrections in debug logger
|
||||
* requirement can have callback
|
||||
|
8
MANIFEST.in
Normal file
8
MANIFEST.in
Normal file
@ -0,0 +1,8 @@
|
||||
# Include the README
|
||||
include *.rst
|
||||
|
||||
# Include the license file
|
||||
include LICENSE.txt
|
||||
|
||||
# Include the data files
|
||||
recursive-include tiramisu *.py *.mo
|
14
Makefile
14
Makefile
@ -10,7 +10,7 @@ INSTALL_DATA := install -m 644
|
||||
INSTALL_PROGRAM := install -m 755
|
||||
INSTALL_DIR := install -m 755 -d
|
||||
|
||||
TRADUC_DIR = translations
|
||||
TRADUC_DIR = tiramisu/locale
|
||||
TRADUC_DEST = $(DESTDIR)/usr/share/locale
|
||||
|
||||
PYTHON_OPTS =
|
||||
@ -26,7 +26,7 @@ define gettext
|
||||
else \
|
||||
P="pygettext.py" ; \
|
||||
fi ; \
|
||||
$$P -p translations/ -o $(PACKAGE).pot `find $(PACKAGE)/ -name "*.py"`
|
||||
$$P -p $(TRADUC_DIR)/ -o $(PACKAGE).pot `find $(PACKAGE)/ -name "*.py"`
|
||||
endef
|
||||
|
||||
# Build translation files
|
||||
@ -69,12 +69,12 @@ build-pot:
|
||||
build-lang:
|
||||
$(call build_translation, $(TRADUC_DIR))
|
||||
|
||||
install-lang:
|
||||
$(INSTALL_DIR) $(TRADUC_DEST)
|
||||
$(call install_translation, $(TRADUC_DIR))
|
||||
# install-lang:
|
||||
# $(INSTALL_DIR) $(TRADUC_DEST)
|
||||
# $(call install_translation, $(TRADUC_DIR))
|
||||
|
||||
install: install-lang
|
||||
python setup.py install --no-compile $(PYTHON_OPTS)
|
||||
install: # install-lang
|
||||
python3 setup.py install --no-compile $(PYTHON_OPTS)
|
||||
|
||||
dist:
|
||||
git archive --format=tar --prefix $(PACKAGE)-$(VERSION)/ HEAD | gzip -9 > $(PACKAGE)-$(VERSION).tar.gz
|
||||
|
58
setup.py
58
setup.py
@ -1,57 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from distutils.core import setup
|
||||
from os.path import dirname, abspath, join, normpath, isdir
|
||||
from os import listdir
|
||||
from setuptools import setup, find_packages
|
||||
import os
|
||||
from tiramisu import __version__
|
||||
|
||||
|
||||
package_name = os.environ.get('PACKAGE_DST', 'tiramisu')
|
||||
|
||||
def fetch_version():
|
||||
"""Get version from version.in"""
|
||||
return open('VERSION', 'r').readline().strip()
|
||||
|
||||
|
||||
def return_files(component):
|
||||
here = dirname(abspath(__file__))
|
||||
path = normpath(join(here, 'tiramisu', component))
|
||||
dir_content = [content for content in listdir(path)
|
||||
if not content == '__pycache__']
|
||||
paths = filter(isdir, [join(path, content)
|
||||
for content in dir_content])
|
||||
lst = ['.'.join(path.split('/')[-3:]) for path in paths]
|
||||
#lst = [package_name + '.' + '.'.join(path.split('/')[-2:]) for path in paths]
|
||||
return lst
|
||||
|
||||
|
||||
packages = [package_name, package_name + '.storage', package_name + '.option']
|
||||
packages.extend(return_files('storage'))
|
||||
packages.extend(return_files('option'))
|
||||
|
||||
if package_name != 'tiramisu':
|
||||
package_dir = {package_name: 'tiramisu'}
|
||||
else:
|
||||
package_dir = {}
|
||||
PACKAGE_NAME = os.environ.get('PACKAGE_DST', 'tiramisu')
|
||||
|
||||
setup(
|
||||
version=__version__,
|
||||
author="Tiramisu's team",
|
||||
author_email='contact@cadoles.com',
|
||||
name=package_name,
|
||||
version=fetch_version(),
|
||||
author_email='gnunux@gnunux.info',
|
||||
name=PACKAGE_NAME,
|
||||
description='an options controller tool',
|
||||
url='http://tiramisu.labs.libre-entreprise.org/',
|
||||
url='https://framagit.org/tiramisu/tiramisu',
|
||||
license='GNU Library or Lesser General Public License (LGPL)',
|
||||
provides=['tiramisu_api'],
|
||||
classifiers=[
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: Other Environment",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
||||
"Operating System :: OS Independent",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: Text Processing :: Linguistic"
|
||||
"Natural Language :: English",
|
||||
"Natural Language :: French",
|
||||
],
|
||||
long_description="""\
|
||||
An options controller tool
|
||||
@ -67,8 +37,8 @@ Tiramisu is an options handler and an options controller, wich aims at
|
||||
producing flexible and fast options access.
|
||||
|
||||
|
||||
This version requires Python 2.6 or later.
|
||||
This version requires Python 3.5 or later.
|
||||
""",
|
||||
packages=packages,
|
||||
package_dir=package_dir
|
||||
include_package_data=True,
|
||||
packages=find_packages(include=['tiramisu'])
|
||||
)
|
||||
|
@ -1,216 +0,0 @@
|
||||
"test all types of option default values for options, add new option in a descr"
|
||||
from .autopath import do_autopath
|
||||
do_autopath()
|
||||
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu.setting import owners
|
||||
from tiramisu.error import PropertiesOptionError, ConfigError
|
||||
from tiramisu import IntOption, FloatOption, StrOption, ChoiceOption, \
|
||||
BoolOption, OptionDescription, Leadership, Config, undefined
|
||||
from tiramisu.storage import list_sessions
|
||||
|
||||
|
||||
def teardown_function(function):
|
||||
assert list_sessions() == [], 'session list is not empty when leaving "{}"'.format(function.__name__)
|
||||
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
|
||||
#____________________________________________________________
|
||||
# default values
|
||||
def test_default_is_none():
|
||||
"""
|
||||
Most constructors take a ``default`` argument that specifies the default
|
||||
value of the option. If this argument is not supplied the default value is
|
||||
assumed to be ``None``.
|
||||
"""
|
||||
dummy1 = BoolOption('dummy1', 'doc dummy')
|
||||
dummy2 = BoolOption('dummy2', 'doc dummy')
|
||||
group = OptionDescription('group', '', [dummy1, dummy2])
|
||||
api = Config(group)
|
||||
# so when the default value is not set, there is actually a default value
|
||||
assert api.option('dummy1').value.get() is None
|
||||
assert api.option('dummy2').value.get() is None
|
||||
|
||||
|
||||
def test_set_defaut_value_from_option_object():
|
||||
"""Options have an available default setting and can give it back"""
|
||||
b = BoolOption("boolean", "", default=False)
|
||||
assert b.impl_getdefault() is False
|
||||
|
||||
|
||||
def test_force_default_on_freeze():
|
||||
"a frozen option wich is forced returns his default"
|
||||
dummy1 = BoolOption('dummy1', 'doc dummy', default=False, properties=('force_default_on_freeze',))
|
||||
dummy2 = BoolOption('dummy2', 'doc dummy', default=True)
|
||||
group = OptionDescription('group', '', [dummy1, dummy2])
|
||||
api = Config(group)
|
||||
api.property.read_write()
|
||||
owner = api.owner.get()
|
||||
api.option('dummy1').value.set(True)
|
||||
api.option('dummy2').value.set(False)
|
||||
assert api.option('dummy1').owner.get() == owner
|
||||
assert api.option('dummy2').owner.get() == owner
|
||||
api.option('dummy1').property.add('frozen')
|
||||
api.option('dummy2').property.add('frozen')
|
||||
assert api.option('dummy1').value.get() is False
|
||||
assert api.option('dummy2').value.get() is False
|
||||
assert api.option('dummy1').owner.isdefault()
|
||||
assert api.option('dummy2').owner.get() == owner
|
||||
raises(PropertiesOptionError, "api.option('dummy2').owner.set('frozen')")
|
||||
raises(PropertiesOptionError, "api.option('dummy1').value.reset()")
|
||||
api.option('dummy1').property.pop('frozen')
|
||||
api.option('dummy1').value.reset()
|
||||
api.option('dummy1').property.add('frozen')
|
||||
raises(PropertiesOptionError, "api.option('dummy2').owner.set('frozen')")
|
||||
|
||||
|
||||
def test_force_default_on_freeze_multi():
|
||||
dummy1 = BoolOption('dummy1', 'doc dummy', default=[False], properties=('force_default_on_freeze',), multi=True)
|
||||
dummy2 = BoolOption('dummy2', 'doc dummy', default=[True], multi=True)
|
||||
group = OptionDescription('group', '', [dummy1, dummy2])
|
||||
api = Config(group)
|
||||
api.property.read_write()
|
||||
api.option('dummy1').value.set([undefined, True])
|
||||
api.option('dummy2').value.set([undefined, False])
|
||||
owner = api.owner.get()
|
||||
assert api.option('dummy1').owner.get() == owner
|
||||
assert api.option('dummy2').owner.get() == owner
|
||||
api.option('dummy1').property.add('frozen')
|
||||
api.option('dummy2').property.add('frozen')
|
||||
assert api.option('dummy1').value.get() == [False]
|
||||
assert api.option('dummy2').value.get() == [True, False]
|
||||
assert api.option('dummy1').owner.isdefault()
|
||||
assert api.option('dummy2').owner.get() == owner
|
||||
raises(PropertiesOptionError, "api.option('dummy2').owner.set('owner')")
|
||||
raises(PropertiesOptionError, "api.option('dummy2').value.reset()")
|
||||
api.option('dummy1').property.pop('frozen')
|
||||
api.option('dummy1').value.reset()
|
||||
api.option('dummy1').property.add('frozen')
|
||||
|
||||
|
||||
def test_force_default_on_freeze_leader():
|
||||
dummy1 = BoolOption('dummy1', 'Test int option', multi=True, properties=('force_default_on_freeze',))
|
||||
dummy2 = BoolOption('dummy2', 'Test string option', multi=True)
|
||||
descr = Leadership("dummy1", "", [dummy1, dummy2])
|
||||
descr = OptionDescription("root", "", [descr])
|
||||
raises(ConfigError, "Config(descr)")
|
||||
|
||||
|
||||
def test_force_metaconfig_on_freeze_leader():
|
||||
dummy1 = BoolOption('dummy1', 'Test int option', multi=True, properties=('force_metaconfig_on_freeze',))
|
||||
dummy2 = BoolOption('dummy2', 'Test string option', multi=True)
|
||||
descr = Leadership("dummy1", "", [dummy1, dummy2])
|
||||
descr = OptionDescription("root", "", [descr])
|
||||
raises(ConfigError, "Config(descr)")
|
||||
|
||||
|
||||
def test_force_default_on_freeze_leader_frozen():
|
||||
dummy1 = BoolOption('dummy1', 'Test int option', multi=True, properties=('force_default_on_freeze', 'frozen'))
|
||||
dummy2 = BoolOption('dummy2', 'Test string option', multi=True)
|
||||
descr = Leadership("dummy1", "", [dummy1, dummy2])
|
||||
descr = OptionDescription("root", "", [descr])
|
||||
api = Config(descr)
|
||||
raises(ConfigError, "api.option('dummy1.dummy1').property.pop('frozen')")
|
||||
|
||||
|
||||
def test_force_metaconfig_on_freeze_leader_frozen():
|
||||
dummy1 = BoolOption('dummy1', 'Test int option', multi=True, properties=('force_metaconfig_on_freeze', 'frozen'))
|
||||
dummy2 = BoolOption('dummy2', 'Test string option', multi=True)
|
||||
descr = Leadership("dummy1", "", [dummy1, dummy2])
|
||||
descr = OptionDescription("root", "", [descr])
|
||||
api = Config(descr)
|
||||
raises(ConfigError, "api.option('dummy1.dummy1').property.pop('frozen')")
|
||||
|
||||
|
||||
def test_force_default_on_freeze_follower():
|
||||
dummy1 = BoolOption('dummy1', 'Test int option', multi=True)
|
||||
dummy2 = BoolOption('dummy2', 'Test string option', multi=True, properties=('force_default_on_freeze',))
|
||||
descr = Leadership("dummy1", "", [dummy1, dummy2])
|
||||
descr = OptionDescription("root", "", [descr])
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
owners.addowner("frozenmultifollower2")
|
||||
api.option('dummy1.dummy1').value.set([True])
|
||||
api.option('dummy1.dummy2', 0).value.set(False)
|
||||
assert api.option('dummy1.dummy1').value.get() == [True]
|
||||
assert api.option('dummy1.dummy2', 0).value.get() == False
|
||||
assert api.option('dummy1.dummy1').owner.get() == 'user'
|
||||
assert api.option('dummy1.dummy2', 0).owner.get() == 'user'
|
||||
#
|
||||
api.option('dummy1.dummy2').property.add('frozen')
|
||||
assert api.option('dummy1.dummy1').value.get() == [True]
|
||||
assert api.option('dummy1.dummy2', 0).value.get() == None
|
||||
assert api.option('dummy1.dummy1').owner.get() == 'user'
|
||||
assert api.option('dummy1.dummy2', 0).owner.isdefault()
|
||||
raises(PropertiesOptionError, "api.option('dummy1.dummy2', 0).owner.set('frozenmultifollower2')")
|
||||
#
|
||||
api.option('dummy1.dummy2').property.pop('frozen')
|
||||
api.option('dummy1.dummy1').value.set([True, True])
|
||||
api.option('dummy1.dummy2', 1).value.set(False)
|
||||
assert api.option('dummy1.dummy1').value.get() == [True, True]
|
||||
assert api.option('dummy1.dummy2', 0).value.get() == False
|
||||
assert api.option('dummy1.dummy2', 1).value.get() == False
|
||||
#
|
||||
api.option('dummy1.dummy2').property.add('frozen')
|
||||
assert api.option('dummy1.dummy1').value.get() == [True, True]
|
||||
assert api.option('dummy1.dummy2', 0).value.get() == None
|
||||
assert api.option('dummy1.dummy2', 1).value.get() == None
|
||||
#
|
||||
api.option('dummy1.dummy1').value.pop(1)
|
||||
assert api.option('dummy1.dummy1').value.get() == [True]
|
||||
assert api.option('dummy1.dummy2', 0).value.get() == None
|
||||
#
|
||||
api.option('dummy1.dummy2').property.pop('frozen')
|
||||
assert api.option('dummy1.dummy1').value.get() == [True]
|
||||
assert api.option('dummy1.dummy2', 0).value.get() == False
|
||||
#
|
||||
api.option('dummy1.dummy1').value.set([True, True])
|
||||
assert api.option('dummy1.dummy2', 0).value.get() == False
|
||||
assert api.option('dummy1.dummy2', 1).value.get() == None
|
||||
|
||||
|
||||
def test_overrides_changes_option_value():
|
||||
"with config.override(), the default is changed and the value is changed"
|
||||
descr = OptionDescription("test", "", [
|
||||
BoolOption("b", "", default=False)])
|
||||
api = Config(descr)
|
||||
api.option('b').value.set(True)
|
||||
|
||||
|
||||
def test_choice_with_no_default():
|
||||
descr = OptionDescription("test", "", [
|
||||
ChoiceOption("backend", "", ("c", "cli"))])
|
||||
api = Config(descr)
|
||||
assert api.option('backend').value.get() is None
|
||||
api.option('backend').value.set('c')
|
||||
|
||||
|
||||
def test_choice_with_default():
|
||||
descr = OptionDescription("test", "", [
|
||||
ChoiceOption("backend", "", ("c", "cli"), default="cli")])
|
||||
api = Config(descr)
|
||||
assert api.option('backend').value.get() == 'cli'
|
@ -1,184 +0,0 @@
|
||||
from .autopath import do_autopath
|
||||
do_autopath()
|
||||
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu.setting import owners, groups
|
||||
from tiramisu import ChoiceOption, BoolOption, IntOption, FloatOption, \
|
||||
StrOption, OptionDescription, SymLinkOption, Leadership, Config
|
||||
from tiramisu.error import ConfigError, ConstError, PropertiesOptionError, APIError
|
||||
from tiramisu.storage import list_sessions
|
||||
|
||||
|
||||
def teardown_function(function):
|
||||
assert list_sessions() == [], 'session list is not empty when leaving "{}"'.format(function.__name__)
|
||||
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False)
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('tiram', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
|
||||
def test_default_owner():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
assert api.option('dummy').value.get() is False
|
||||
assert api.option('dummy').owner.get() == 'default'
|
||||
api.option('dummy').value.set(True)
|
||||
owner = api.owner.get()
|
||||
assert api.option('dummy').owner.get() == owner
|
||||
|
||||
|
||||
def test_hidden_owner():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False, properties=('hidden',))
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
#raises(PropertiesOptionError, "api.forcepermissive.option('dummy').owner.get()")
|
||||
#raises(PropertiesOptionError, "api.option('dummy').owner.isdefault()")
|
||||
#raises(PropertiesOptionError, "api.forcepermissive.option('dummy').owner.isdefault()")
|
||||
api.permissive.set(frozenset(['hidden']))
|
||||
api.forcepermissive.option('dummy').value.get()
|
||||
api.forcepermissive.option('dummy').owner.isdefault()
|
||||
|
||||
|
||||
def test_addowner():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
assert api.option('dummy').value.get() is False
|
||||
assert api.option('dummy').owner.get() == 'default'
|
||||
assert api.option('dummy').owner.isdefault()
|
||||
api.owner.set('gen_config')
|
||||
api.option('dummy').value.set(True)
|
||||
assert api.option('dummy').owner.get() == owners.gen_config
|
||||
assert not api.option('dummy').owner.isdefault()
|
||||
|
||||
|
||||
def test_addowner_multiple_time():
|
||||
owners.addowner("testowner2")
|
||||
raises(ConstError, 'owners.addowner("testowner2")')
|
||||
|
||||
|
||||
def test_delete_owner():
|
||||
owners.addowner('deleted2')
|
||||
raises(ConstError, 'del(owners.deleted2)')
|
||||
|
||||
|
||||
def test_owner_is_not_a_string():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
assert api.option('dummy').value.get() is False
|
||||
assert api.option('dummy').owner.get() == owners.default
|
||||
assert api.option('dummy').owner.get() == 'default'
|
||||
assert isinstance(api.option('dummy').owner.get(), owners.Owner)
|
||||
api.option('dummy').value.set(True)
|
||||
assert api.option('dummy').owner.get() == 'user'
|
||||
|
||||
|
||||
def test_setowner_without_valid_owner():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
assert api.option('dummy').value.get() is False
|
||||
assert api.option('dummy').owner.get() == 'default'
|
||||
|
||||
|
||||
def test_setowner_for_value():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
assert api.option('dummy').value.get() is False
|
||||
assert api.option('dummy').owner.get() == 'default'
|
||||
owners.addowner("new2")
|
||||
raises(ConfigError, "api.option('dummy').owner.set('new2')")
|
||||
api.option('dummy').value.set(False)
|
||||
assert api.option('dummy').owner.get() == owners.user
|
||||
api.option('dummy').owner.set('new2')
|
||||
assert api.option('dummy').owner.get() == owners.new2
|
||||
|
||||
|
||||
def test_setowner_forbidden():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
assert api.option('dummy').value.get() is False
|
||||
assert api.option('dummy').owner.get() == 'default'
|
||||
raises(ValueError, "api.owner.set('default')")
|
||||
api.option('dummy').value.set(False)
|
||||
raises(ValueError, "api.option('dummy').owner.set('default')")
|
||||
|
||||
|
||||
def test_setowner_read_only():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
assert api.option('dummy').value.get() is False
|
||||
assert api.option('dummy').owner.get() == 'default'
|
||||
owners.addowner("readonly2")
|
||||
api.option('dummy').value.set(False)
|
||||
assert api.option('dummy').owner.get() == owners.user
|
||||
api.property.read_only()
|
||||
raises(PropertiesOptionError,
|
||||
"api.option('dummy').owner.set('readonly2')")
|
||||
assert api.option('dummy').owner.get() == owners.user
|
||||
|
||||
|
||||
def test_setowner_optiondescription():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr1 = OptionDescription('tiramisu', '', [gcdummy])
|
||||
descr = OptionDescription('tiramisu', '', [descr1])
|
||||
api = Config(descr)
|
||||
raises(APIError, "api.option('tiramisu').owner.get()")
|
||||
raises(APIError, "api.option('tiramisu').owner.set('user')")
|
||||
|
||||
|
||||
def test_setowner_symlinkoption():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
s = SymLinkOption('symdummy', gcdummy)
|
||||
descr1 = OptionDescription('tiramisu', '', [gcdummy, s])
|
||||
descr = OptionDescription('tiramisu', '', [descr1])
|
||||
api = Config(descr)
|
||||
assert api.option('tiramisu.symdummy').owner.isdefault()
|
||||
api.option('tiramisu.dummy').value.set(True)
|
||||
assert not api.option('tiramisu.symdummy').owner.isdefault()
|
||||
raises(ConfigError, "api.option('tiramisu.symdummy').owner.set('user')")
|
||||
|
||||
|
||||
def test_owner_leadership():
|
||||
b = IntOption('int', 'Test int option', default=[0], multi=True)
|
||||
c = StrOption('str', 'Test string option', multi=True)
|
||||
descr = Leadership("int", "", [b, c])
|
||||
od = OptionDescription('od', '', [descr])
|
||||
api = Config(od)
|
||||
raises(ConfigError, "api.option('int.str', 0).owner.set('user')")
|
||||
|
||||
api.option('int.int').value.set([0, 1])
|
||||
api.option('int.str', 0).value.set('yes')
|
||||
assert not api.option('int.str', 0).owner.isdefault()
|
||||
assert api.option('int.str', 1).owner.isdefault()
|
||||
api.option('int.str', 0).owner.set('user')
|
||||
assert api.option('int.str', 0).owner.get() == owners.user
|
||||
assert api.option('int.str', 1).owner.isdefault()
|
||||
assert api.option('int.str', 0).value.get() == 'yes'
|
||||
assert api.option('int.str', 1).value.get() == None
|
@ -1,139 +0,0 @@
|
||||
# coding: utf-8
|
||||
"frozen and hidden values"
|
||||
from .autopath import do_autopath
|
||||
do_autopath()
|
||||
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu import ChoiceOption, BoolOption, IntOption, FloatOption, \
|
||||
PasswordOption, StrOption, DateOption, OptionDescription, Config
|
||||
from tiramisu.error import PropertiesOptionError
|
||||
from tiramisu.storage import list_sessions
|
||||
|
||||
|
||||
def teardown_function(function):
|
||||
assert list_sessions() == [], 'session list is not empty when leaving "{}"'.format(function.__name__)
|
||||
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ('ref', 'framework'), 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False, properties=(('hidden'),))
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
('std', 'thunk'), ['std'], multi=True)
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=({'option': gcoption, 'expected': 'ref', 'action': 'hidden'},))
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=({'option': gcoption, 'expected': 'framework', 'action': 'hidden'},))
|
||||
|
||||
# ____________________________________________________________
|
||||
booloptiontwo = BoolOption('booltwo', 'Test boolean option two', default=False)
|
||||
subgroup = OptionDescription('subgroup', '', [booloptiontwo])
|
||||
# ____________________________________________________________
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [subgroup, gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('trs', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption])
|
||||
return descr
|
||||
|
||||
|
||||
# ____________________________________________________________
|
||||
def test_is_hidden():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
assert not 'frozen' in api.forcepermissive.option('gc.dummy').property.get()
|
||||
# setattr
|
||||
raises(PropertiesOptionError, "api.option('gc.dummy').value.get() == False")
|
||||
# getattr
|
||||
raises(PropertiesOptionError, "api.option('gc.dummy').value.get()")
|
||||
|
||||
|
||||
def test_group_is_hidden():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
api.option('gc').property.add('hidden')
|
||||
raises(PropertiesOptionError, "api.option('gc.dummy').value.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.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
|
||||
prop = []
|
||||
try:
|
||||
api.option('gc.dummy').value.set(False)
|
||||
except PropertiesOptionError as err:
|
||||
prop = err.proptype
|
||||
assert 'hidden' in prop
|
||||
|
||||
|
||||
def test_group_is_hidden_multi():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
api.option('objspace').property.add('hidden')
|
||||
raises(PropertiesOptionError, "api.option('objspace').value.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.forcepermissive.option('objspace').property.pop('hidden')
|
||||
assert not 'hidden' in api.option('objspace').property.get()
|
||||
api.option('objspace').value.set(['std', 'std'])
|
||||
|
||||
|
||||
def test_global_show():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
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")
|
||||
|
||||
|
||||
def test_with_many_subgroups():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
#booltwo = config.unwrap_from_path('gc.subgroup.booltwo')
|
||||
#setting = config.cfgimpl_get_settings()
|
||||
assert not 'hidden' in api.option('gc.subgroup.booltwo').property.get()
|
||||
assert api.option('gc.subgroup.booltwo').value.get() is False
|
||||
api.option('gc.subgroup.booltwo').property.add('hidden')
|
||||
|
||||
|
||||
def test_password_option():
|
||||
o = PasswordOption('o', '')
|
||||
d = OptionDescription('d', '', [o])
|
||||
api = Config(d)
|
||||
|
||||
api.option('o').value.set('a_valid_password')
|
||||
raises(ValueError, "api.option('o').value.set(1)")
|
||||
|
||||
|
||||
def test_date_option():
|
||||
o = DateOption('o', '')
|
||||
d = OptionDescription('d', '', [o])
|
||||
api = Config(d)
|
||||
|
||||
api.option('o').value.set('2017-02-04')
|
||||
api.option('o').value.set('2017-2-4')
|
||||
raises(ValueError, "api.option('o').value.set(1)")
|
||||
raises(ValueError, "api.option('o').value.set('2017-13-20')")
|
||||
raises(ValueError, "api.option('o').value.set('2017-11-31')")
|
||||
raises(ValueError, "api.option('o').value.set('2017-12-32')")
|
||||
raises(ValueError, "api.option('o').value.set('2017-2-29')")
|
||||
raises(ValueError, "api.option('o').value.set('2-2-2017')")
|
||||
raises(ValueError, "api.option('o').value.set('2017/2/2')")
|
@ -1,379 +0,0 @@
|
||||
# coding: utf-8
|
||||
from .autopath import do_autopath
|
||||
do_autopath()
|
||||
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu import IntOption, UnicodeOption, OptionDescription, Config
|
||||
from tiramisu.error import PropertiesOptionError, ConfigError
|
||||
from tiramisu.api import TIRAMISU_VERSION
|
||||
from tiramisu.storage import list_sessions, delete_session
|
||||
|
||||
|
||||
def teardown_function(function):
|
||||
assert list_sessions() == [], 'session list is not empty when leaving "{}"'.format(function.__name__)
|
||||
|
||||
|
||||
def make_description():
|
||||
u1 = IntOption('u1', '', properties=('frozen', 'mandatory', 'disabled', ))
|
||||
u2 = IntOption('u2', '', properties=('frozen', 'mandatory', 'disabled', ))
|
||||
return OptionDescription('od1', '', [u1, u2])
|
||||
|
||||
|
||||
def test_permissive():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
api.property.read_write()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
api.unrestraint.permissive.set(frozenset(['disabled']))
|
||||
assert api.unrestraint.permissive.get() == frozenset(['disabled'])
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
api.property.add('permissive')
|
||||
api.option('u1').value.get()
|
||||
api.property.pop('permissive')
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
|
||||
def test_permissive_add():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
api.property.read_write()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
api.unrestraint.permissive.add('disabled')
|
||||
assert api.unrestraint.permissive.get() == frozenset(['hidden', 'disabled'])
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
api.property.add('permissive')
|
||||
api.option('u1').value.get()
|
||||
api.property.pop('permissive')
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
|
||||
def test_permissive_pop():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
api.property.read_write()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.forcepermissive.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
api.unrestraint.permissive.add('disabled')
|
||||
assert api.unrestraint.permissive.get() == frozenset(['hidden', 'disabled'])
|
||||
api.forcepermissive.option('u1').value.get()
|
||||
api.unrestraint.permissive.pop('disabled')
|
||||
props = frozenset()
|
||||
try:
|
||||
api.forcepermissive.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
|
||||
def test_permissive_reset():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
assert api.unrestraint.permissive.get() == frozenset(['hidden'])
|
||||
#
|
||||
api.unrestraint.permissive.set(frozenset(['disabled']))
|
||||
assert api.unrestraint.permissive.get() == frozenset(['disabled'])
|
||||
#
|
||||
api.unrestraint.permissive.reset()
|
||||
assert api.unrestraint.permissive.get() == frozenset()
|
||||
|
||||
|
||||
def test_permissive_mandatory():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_only()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
if TIRAMISU_VERSION == 2:
|
||||
assert frozenset(props) == frozenset(['disabled', 'mandatory'])
|
||||
else:
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
api.unrestraint.permissive.set(frozenset(['mandatory', 'disabled']))
|
||||
assert api.unrestraint.permissive.get() == frozenset(['mandatory', 'disabled'])
|
||||
api.property.add('permissive')
|
||||
api.option('u1').value.get()
|
||||
api.property.pop('permissive')
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
if TIRAMISU_VERSION == 2:
|
||||
assert frozenset(props) == frozenset(['disabled', 'mandatory'])
|
||||
else:
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
|
||||
|
||||
def test_permissive_frozen():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
api.unrestraint.permissive.set(frozenset(['frozen', 'disabled']))
|
||||
assert api.unrestraint.permissive.get() == frozenset(['frozen', 'disabled'])
|
||||
assert api.permissive.get() == frozenset(['frozen', 'disabled'])
|
||||
try:
|
||||
api.option('u1').value.set(1)
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
if TIRAMISU_VERSION == 2:
|
||||
assert frozenset(props) == frozenset(['disabled', 'frozen'])
|
||||
else:
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
api.property.add('permissive')
|
||||
api.option('u1').value.set(1)
|
||||
assert api.option('u1').value.get() == 1
|
||||
api.property.pop('permissive')
|
||||
try:
|
||||
api.option('u1').value.set(1)
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
if TIRAMISU_VERSION == 2:
|
||||
assert frozenset(props) == frozenset(['disabled', 'frozen'])
|
||||
else:
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
|
||||
|
||||
def test_invalid_permissive():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
raises(TypeError, "api.unrestraint.permissive.set(['frozen', 'disabled'])")
|
||||
|
||||
|
||||
def test_forbidden_permissive():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
raises(ConfigError, "api.permissive.set(frozenset(['force_default_on_freeze']))")
|
||||
raises(ConfigError, "api.permissive.set(frozenset(['force_metaconfig_on_freeze']))")
|
||||
|
||||
|
||||
def test_permissive_option():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
api.unrestraint.option('u1').permissive.set(frozenset(['disabled']))
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert frozenset(props) == frozenset()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
api.property.add('permissive')
|
||||
api.option('u1').value.get()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
api.property.pop('permissive')
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert frozenset(props) == frozenset()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
|
||||
def test_permissive_option_cache():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
api.unrestraint.option('u1').permissive.set(frozenset(['disabled']))
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert frozenset(props) == frozenset()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
api.property.add('permissive')
|
||||
api.option('u1').value.get()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
api.property.pop('permissive')
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert frozenset(props) == frozenset()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u2').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == {'disabled'}
|
||||
|
||||
|
||||
def test_permissive_option_mandatory():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_only()
|
||||
props = frozenset()
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
if TIRAMISU_VERSION == 2:
|
||||
assert frozenset(props) == frozenset(['disabled', 'mandatory'])
|
||||
else:
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
api.unrestraint.option('u1').permissive.set(frozenset(['mandatory', 'disabled']))
|
||||
assert api.unrestraint.option('u1').permissive.get() == frozenset(['mandatory', 'disabled'])
|
||||
api.property.add('permissive')
|
||||
api.option('u1').value.get()
|
||||
api.property.pop('permissive')
|
||||
try:
|
||||
api.option('u1').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
if TIRAMISU_VERSION == 2:
|
||||
assert frozenset(props) == frozenset(['disabled', 'mandatory'])
|
||||
else:
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
|
||||
|
||||
def test_permissive_option_frozen():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
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')
|
||||
assert api.option('u1').value.get() == 1
|
||||
api.property.pop('permissive')
|
||||
assert api.option('u1').value.get() == 1
|
||||
|
||||
|
||||
if TIRAMISU_VERSION == 3:
|
||||
def test_invalid_option_permissive():
|
||||
descr = make_description()
|
||||
api = Config(descr)
|
||||
api.property.read_write()
|
||||
raises(TypeError, "api.unrestraint.option('u1').permissive.set(['frozen', 'disabled'])")
|
||||
|
||||
|
||||
def test_remove_option_permissive():
|
||||
var1 = UnicodeOption('var1', '', u'value', properties=('hidden',))
|
||||
od1 = OptionDescription('od1', '', [var1])
|
||||
rootod = OptionDescription('rootod', '', [od1])
|
||||
api = Config(rootod)
|
||||
api.property.read_write()
|
||||
raises(PropertiesOptionError, "api.option('od1.var1').value.get()")
|
||||
api.forcepermissive.option('od1.var1').permissive.set(frozenset(['hidden']))
|
||||
assert api.forcepermissive.option('od1.var1').permissive.get() == frozenset(['hidden'])
|
||||
assert api.option('od1.var1').value.get() == 'value'
|
||||
api.forcepermissive.option('od1.var1').permissive.set(frozenset())
|
||||
assert api.forcepermissive.option('od1.var1').permissive.get() == frozenset()
|
||||
raises(PropertiesOptionError, "api.option('od1.var1').value.get()")
|
||||
|
||||
|
||||
def test_reset_option_permissive():
|
||||
var1 = UnicodeOption('var1', '', u'value', properties=('hidden',))
|
||||
od1 = OptionDescription('od1', '', [var1])
|
||||
rootod = OptionDescription('rootod', '', [od1])
|
||||
api = Config(rootod)
|
||||
api.property.read_write()
|
||||
raises(PropertiesOptionError, "api.option('od1.var1').value.get()")
|
||||
api.forcepermissive.option('od1.var1').permissive.set(frozenset(['hidden']))
|
||||
assert api.forcepermissive.option('od1.var1').permissive.get() == frozenset(['hidden'])
|
||||
assert api.option('od1.var1').value.get() == 'value'
|
||||
api.forcepermissive.option('od1.var1').permissive.reset()
|
||||
assert api.forcepermissive.option('od1.var1').permissive.get() == frozenset()
|
||||
raises(PropertiesOptionError, "api.option('od1.var1').value.get()")
|
@ -949,8 +949,6 @@ def autocheck_default_owner_with_value_permissive(cfg, mcfg, pathread, pathwrite
|
||||
else:
|
||||
assert cfg_.forcepermissive.option(pathread, 0).owner.isdefault() is True
|
||||
assert cfg_.forcepermissive.option(pathread, 1).owner.isdefault() is False
|
||||
#FIXME else:
|
||||
# raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathread).owner.isdefault()")
|
||||
do(confwrite)
|
||||
if confwrite != confread:
|
||||
do(confread)
|
42
tests/config.py
Normal file
42
tests/config.py
Normal file
@ -0,0 +1,42 @@
|
||||
# from json import dumps, loads
|
||||
try:
|
||||
from tiramisu_api import Config
|
||||
class TestConfig(Config):
|
||||
def __init__(self,
|
||||
config):
|
||||
self.test_option = config.option
|
||||
json = self.test_option.dict()
|
||||
# assert json == loads(dumps(json))
|
||||
super().__init__(json)
|
||||
|
||||
def send_data(self,
|
||||
updates):
|
||||
return self.updates_data(self.test_option.updates(updates))
|
||||
PARAMS = ['tiramisu', 'tiramisu-api']
|
||||
except:
|
||||
PARAMS = ['tiramisu']
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def get_config(config, type, error=False):
|
||||
if type == 'tiramisu':
|
||||
return config
|
||||
if error:
|
||||
config.property.add('demoting_error_warning')
|
||||
return TestConfig(config)
|
||||
|
||||
|
||||
def value_list(values):
|
||||
if values[0] == '':
|
||||
del values[0]
|
||||
return tuple(values)
|
||||
|
||||
|
||||
def global_owner(config, config_type):
|
||||
return config.owner.get()
|
||||
|
||||
|
||||
@pytest.fixture(params=PARAMS)
|
||||
def config_type(request):
|
||||
return request.param
|
0
tests/dict/__init__.py
Normal file
0
tests/dict/__init__.py
Normal file
0
tests/dict/data/__init__.py
Normal file
0
tests/dict/data/__init__.py
Normal file
43
tests/dict/data/boolean1.json
Normal file
43
tests/dict/data/boolean1.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.boolean": {
|
||||
"type": "boolean",
|
||||
"title": "Boolean 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.boolean": {
|
||||
"clearable": true
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
12
tests/dict/data/boolean1.py
Normal file
12
tests/dict/data/boolean1.py
Normal file
@ -0,0 +1,12 @@
|
||||
"""just an boolean option
|
||||
"""
|
||||
from tiramisu.option import BoolOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = BoolOption('boolean', "Boolean 1")
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("boolean1", "Simple boolean", [descr1])
|
||||
return descr
|
||||
|
47
tests/dict/data/boolean1_frozen.json
Normal file
47
tests/dict/data/boolean1_frozen.json
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.boolean": {
|
||||
"type": "boolean",
|
||||
"title": "Boolean 1 frozen"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.boolean": {
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.boolean": {
|
||||
"clearable": true
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
12
tests/dict/data/boolean1_frozen.py
Normal file
12
tests/dict/data/boolean1_frozen.py
Normal file
@ -0,0 +1,12 @@
|
||||
"""just an boolean option
|
||||
"""
|
||||
from tiramisu.option import BoolOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = BoolOption('boolean', "Boolean 1 frozen", properties=('frozen',))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("boolean1_frozen", "Simple boolean", [descr1])
|
||||
return descr
|
||||
|
49
tests/dict/data/choice1.json
Normal file
49
tests/dict/data/choice1.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice": {
|
||||
"type": "choice",
|
||||
"enum": [
|
||||
"",
|
||||
"choice 1",
|
||||
"choice 2"
|
||||
],
|
||||
"title": "Choice description"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
10
tests/dict/data/choice1.py
Normal file
10
tests/dict/data/choice1.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
from tiramisu.option import ChoiceOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = ChoiceOption('choice', "Choice description", ("choice 1", "choice 2"))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("choice1", "Simple choice", [descr1])
|
||||
return descr
|
53
tests/dict/data/choice1_frozen.json
Normal file
53
tests/dict/data/choice1_frozen.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice": {
|
||||
"type": "choice",
|
||||
"enum": [
|
||||
"",
|
||||
"choice 1",
|
||||
"choice 2"
|
||||
],
|
||||
"title": "Choice description frozen"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.choice": {
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
10
tests/dict/data/choice1_frozen.py
Normal file
10
tests/dict/data/choice1_frozen.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
from tiramisu.option import ChoiceOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = ChoiceOption('choice', "Choice description frozen", ("choice 1", "choice 2"), properties=('frozen',))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("choice1_frozen", "Simple choice", [descr1])
|
||||
return descr
|
101
tests/dict/data/choice1_leadership.json
Normal file
101
tests/dict/data/choice1_leadership.json
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice1": {
|
||||
"properties": {
|
||||
"options.choice1.choice1": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"choice 1",
|
||||
"choice 2"
|
||||
],
|
||||
"title": "Choice description leader"
|
||||
},
|
||||
"options.choice1.choice2": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 3",
|
||||
"choice 4"
|
||||
],
|
||||
"title": "Choice description follower 1"
|
||||
},
|
||||
"options.choice1.choice3": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 5",
|
||||
"choice 6"
|
||||
],
|
||||
"title": "Choice description follower 2"
|
||||
},
|
||||
"options.choice1.choice4": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 7",
|
||||
"choice 8"
|
||||
],
|
||||
"title": "Choice description follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.choice1.choice1": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice1.choice1": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice2": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice3": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice4": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
16
tests/dict/data/choice1_leadership.py
Normal file
16
tests/dict/data/choice1_leadership.py
Normal file
@ -0,0 +1,16 @@
|
||||
from tiramisu.option import ChoiceOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = ChoiceOption('choice1', "Choice description leader", ("choice 1", "choice 2"), multi=True)
|
||||
option1 = ChoiceOption('choice2', "Choice description follower 1", ("choice 3", "choice 4"), multi=True)
|
||||
option2 = ChoiceOption('choice3', "Choice description follower 2", ("choice 5", "choice 6"), multi=True)
|
||||
option3 = ChoiceOption('choice4', "Choice description follower 3", ("choice 7", "choice 8"), multi=True)
|
||||
descr1 = Leadership("choice1", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("choice1_leadership", "Leader followers with choice", [descr])
|
||||
return descr
|
106
tests/dict/data/choice1_leadership_hidden.json
Normal file
106
tests/dict/data/choice1_leadership_hidden.json
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice1": {
|
||||
"properties": {
|
||||
"options.choice1.choice1": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"choice 1",
|
||||
"choice 2"
|
||||
],
|
||||
"title": "Choice description leader"
|
||||
},
|
||||
"options.choice1.choice2": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 3",
|
||||
"choice 4"
|
||||
],
|
||||
"title": "Choice description follower 1"
|
||||
},
|
||||
"options.choice1.choice3": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 5",
|
||||
"choice 6"
|
||||
],
|
||||
"title": "Choice description follower 2 hidden"
|
||||
},
|
||||
"options.choice1.choice4": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 7",
|
||||
"choice 8"
|
||||
],
|
||||
"title": "Choice description follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Slave 2 is hidden"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.choice1.choice1": {
|
||||
"required": true
|
||||
},
|
||||
"options.choice1.choice3": {
|
||||
"null": {
|
||||
"display": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice1.choice1": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice2": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice3": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice4": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
16
tests/dict/data/choice1_leadership_hidden.py
Normal file
16
tests/dict/data/choice1_leadership_hidden.py
Normal file
@ -0,0 +1,16 @@
|
||||
from tiramisu.option import ChoiceOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
from tiramisu.setting import groups
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = ChoiceOption('choice1', "Choice description leader", ("choice 1", "choice 2"), multi=True)
|
||||
option1 = ChoiceOption('choice2', "Choice description follower 1", ("choice 3", "choice 4"), multi=True)
|
||||
option2 = ChoiceOption('choice3', "Choice description follower 2 hidden", ("choice 5", "choice 6"), multi=True, properties=('hidden',))
|
||||
option3 = ChoiceOption('choice4', "Choice description follower 3", ("choice 7", "choice 8"), multi=True)
|
||||
descr1 = Leadership("choice1", "Slave 2 is hidden",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("choice1_leadership_hidden", "Leader follower with choice, one is hidden", [descr])
|
||||
return descr
|
111
tests/dict/data/choice1_leadership_value.json
Normal file
111
tests/dict/data/choice1_leadership_value.json
Normal file
@ -0,0 +1,111 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice1": {
|
||||
"properties": {
|
||||
"options.choice1.choice1": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"choice 1",
|
||||
"choice 2"
|
||||
],
|
||||
"title": "Choice leader"
|
||||
},
|
||||
"options.choice1.choice2": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 3",
|
||||
"choice 4"
|
||||
],
|
||||
"title": "Choice follower 1"
|
||||
},
|
||||
"options.choice1.choice3": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 5",
|
||||
"choice 6"
|
||||
],
|
||||
"title": "Choice follower 2"
|
||||
},
|
||||
"options.choice1.choice4": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"",
|
||||
"choice 7",
|
||||
"choice 8"
|
||||
],
|
||||
"title": "Choice follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.choice1.choice1": {
|
||||
"required": true,
|
||||
"value": [
|
||||
"choice 2"
|
||||
],
|
||||
"owner": "user"
|
||||
},
|
||||
"options.choice1.choice2": {
|
||||
"0": {
|
||||
"value": "choice 4",
|
||||
"owner": "user"
|
||||
}
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice1.choice1": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice2": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice3": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"options.choice1.choice4": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
25
tests/dict/data/choice1_leadership_value.py
Normal file
25
tests/dict/data/choice1_leadership_value.py
Normal file
@ -0,0 +1,25 @@
|
||||
from tiramisu.option import ChoiceOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = ChoiceOption('choice1', "Choice leader", ("choice 1", "choice 2"), multi=True)
|
||||
option1 = ChoiceOption('choice2', "Choice follower 1", ("choice 3", "choice 4"), multi=True)
|
||||
option2 = ChoiceOption('choice3', "Choice follower 2", ("choice 5", "choice 6"), multi=True)
|
||||
option3 = ChoiceOption('choice4', "Choice follower 3", ("choice 7", "choice 8"), multi=True)
|
||||
descr1 = Leadership("choice1", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("choice1_leadership_value", "Leader followers with choices, leader is 'choice 2' and follower 1 is 'choice 4'", [descr])
|
||||
return descr
|
||||
|
||||
|
||||
def get_values(api, allpath=False):
|
||||
if allpath:
|
||||
root = 'choice1_leadership_value.'
|
||||
else:
|
||||
root = ''
|
||||
api.option(root + 'options.choice1.choice1').value.set(['choice 2'])
|
||||
api.option(root + 'options.choice1.choice2', 0).value.set('choice 4')
|
53
tests/dict/data/choice1_multi.json
Normal file
53
tests/dict/data/choice1_multi.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice": {
|
||||
"type": "choice",
|
||||
"isMulti": true,
|
||||
"enum": [
|
||||
"choice 1",
|
||||
"choice 2"
|
||||
],
|
||||
"title": "Choice description"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.choice": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice": {
|
||||
"clearable": true,
|
||||
"type": "choice"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
10
tests/dict/data/choice1_multi.py
Normal file
10
tests/dict/data/choice1_multi.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
from tiramisu.option import ChoiceOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = ChoiceOption('choice', "Choice description", ("choice 1", "choice 2"), multi=True)
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("choice1_multi", "Multi choice", [descr1])
|
||||
return descr
|
53
tests/dict/data/choice1_rename.json
Normal file
53
tests/dict/data/choice1_rename.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice": {
|
||||
"type": "choice",
|
||||
"enum": [
|
||||
"",
|
||||
"choice 1",
|
||||
"choice 2"
|
||||
],
|
||||
"title": "Choice description"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice": {
|
||||
"clearable": true,
|
||||
"type": "choice",
|
||||
"displayed": {
|
||||
"choice 1": "renamed 1",
|
||||
"choice 2": "renamed 2"
|
||||
}
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
20
tests/dict/data/choice1_rename.py
Normal file
20
tests/dict/data/choice1_rename.py
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
from tiramisu.option import ChoiceOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = ChoiceOption('choice', "Choice description", ("choice 1", "choice 2"))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("choice1_rename", "Rename displayed value", [descr1])
|
||||
return descr
|
||||
|
||||
|
||||
def get_form(allpath=False):
|
||||
key = 'options.choice'
|
||||
if allpath:
|
||||
key = 'choice1_rename.' + key
|
||||
return [{'key': key,
|
||||
'displayed': {'choice 1': 'renamed 1',
|
||||
'choice 2': 'renamed 2'}
|
||||
}]
|
85
tests/dict/data/choice1_requires.json
Normal file
85
tests/dict/data/choice1_requires.json
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.choice": {
|
||||
"type": "choice",
|
||||
"enum": [
|
||||
"hide",
|
||||
"show"
|
||||
],
|
||||
"value": "hide",
|
||||
"title": "Choice description"
|
||||
},
|
||||
"options.unicode2": {
|
||||
"type": "string",
|
||||
"title": "Unicode 2"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.choice": {
|
||||
"required": true,
|
||||
"value": "hide"
|
||||
},
|
||||
"options.unicode2": {
|
||||
"display": false,
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.choice": {
|
||||
"clearable": true,
|
||||
"type": "choice",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"show": [
|
||||
"options.unicode2"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"show": {
|
||||
"show": [
|
||||
"options.unicode2"
|
||||
]
|
||||
},
|
||||
"hide": {
|
||||
"hide": [
|
||||
"options.unicode2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
12
tests/dict/data/choice1_requires.py
Normal file
12
tests/dict/data/choice1_requires.py
Normal file
@ -0,0 +1,12 @@
|
||||
from tiramisu.option import ChoiceOption, StrOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option1 = ChoiceOption('choice', "Choice description", ("hide", "show"), default='hide', properties=('mandatory',))
|
||||
option2 = StrOption('unicode2', "Unicode 2", requires=[{'option': option1,
|
||||
'expected': 'hide',
|
||||
'action': 'hidden'}])
|
||||
descr1 = OptionDescription("options", "Common configuration", [option1, option2])
|
||||
descr = OptionDescription("choice1_requires", "Choice with requirement", [descr1])
|
||||
return descr
|
44
tests/dict/data/date1.json
Normal file
44
tests/dict/data/date1.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.date": {
|
||||
"type": "date",
|
||||
"title": "Date description"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.date": {
|
||||
"clearable": true,
|
||||
"remote": true
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
9
tests/dict/data/date1.py
Normal file
9
tests/dict/data/date1.py
Normal file
@ -0,0 +1,9 @@
|
||||
from tiramisu.option import DateOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = DateOption('date', "Date description")
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("date1", "Simple date", [descr1])
|
||||
return descr
|
48
tests/dict/data/date1_frozen.json
Normal file
48
tests/dict/data/date1_frozen.json
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.date": {
|
||||
"type": "date",
|
||||
"title": "Date description frozen"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.date": {
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.date": {
|
||||
"clearable": true,
|
||||
"remote": true
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
9
tests/dict/data/date1_frozen.py
Normal file
9
tests/dict/data/date1_frozen.py
Normal file
@ -0,0 +1,9 @@
|
||||
from tiramisu.option import DateOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = DateOption('date', "Date description frozen", properties=('frozen',))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("date1_frozen", "Simple date", [descr1])
|
||||
return descr
|
43
tests/dict/data/filename1.json
Normal file
43
tests/dict/data/filename1.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"schema": {
|
||||
"usbpath": {
|
||||
"type": "filename",
|
||||
"title": "Chemin d'acc\u00e8s"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"usbpath": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"usbpath": {
|
||||
"clearable": true,
|
||||
"pattern": "^[a-zA-Z0-9\\-\\._~/+]+$",
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
6
tests/dict/data/filename1.py
Normal file
6
tests/dict/data/filename1.py
Normal file
@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from tiramisu.option import FilenameOption, OptionDescription
|
||||
def get_description():
|
||||
usbpath = FilenameOption('usbpath', "Chemin d'accès", properties=('mandatory',))
|
||||
descr = OptionDescription("filename1", "Simple filename", [usbpath])
|
||||
return descr
|
72
tests/dict/data/hostname1.json
Normal file
72
tests/dict/data/hostname1.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.hostname1": {
|
||||
"type": "domainname",
|
||||
"title": "Domainname Description"
|
||||
},
|
||||
"options.hostname2": {
|
||||
"type": "domainname",
|
||||
"title": "Domainname without dot Description"
|
||||
},
|
||||
"options.hostname3": {
|
||||
"type": "domainname",
|
||||
"title": "Hostname or IP Description"
|
||||
},
|
||||
"options.hostname4": {
|
||||
"type": "domainname",
|
||||
"title": "Netbios Description"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.hostname1": {
|
||||
"clearable": true,
|
||||
"pattern": "^((?!-)[a-z0-9-]{1,63}\\.){1,}[a-z0-9-]{1,63}$",
|
||||
"type": "input"
|
||||
},
|
||||
"options.hostname2": {
|
||||
"clearable": true,
|
||||
"pattern": "^((?!-)[a-z0-9-]{0,63}\\.){0,}[a-z0-9-]{1,63}$",
|
||||
"type": "input"
|
||||
},
|
||||
"options.hostname3": {
|
||||
"clearable": true,
|
||||
"pattern": "^(?:((?!-)[a-z0-9-]{1,63})|(?:(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))$",
|
||||
"type": "input"
|
||||
},
|
||||
"options.hostname4": {
|
||||
"clearable": true,
|
||||
"pattern": "^((?!-)[a-z0-9-]{1,15})$",
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
12
tests/dict/data/hostname1.py
Normal file
12
tests/dict/data/hostname1.py
Normal file
@ -0,0 +1,12 @@
|
||||
from tiramisu.option import DomainnameOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option1 = DomainnameOption('hostname1', "Domainname Description")
|
||||
option2 = DomainnameOption('hostname2', "Domainname without dot Description", allow_without_dot=True)
|
||||
option3 = DomainnameOption('hostname3', "Hostname or IP Description", type_='hostname', allow_ip=True)
|
||||
option4 = DomainnameOption('hostname4', "Netbios Description", type_='netbios')
|
||||
descr1 = OptionDescription("options", "Common configuration", [option1, option2, option3, option4])
|
||||
descr = OptionDescription("hostname1", "Simple hostnames", [descr1])
|
||||
return descr
|
45
tests/dict/data/ip1.json
Normal file
45
tests/dict/data/ip1.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.ip": {
|
||||
"type": "ip",
|
||||
"title": "IP Description"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.ip": {
|
||||
"clearable": true,
|
||||
"remote": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
9
tests/dict/data/ip1.py
Normal file
9
tests/dict/data/ip1.py
Normal file
@ -0,0 +1,9 @@
|
||||
from tiramisu.option import IPOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option1 = IPOption('ip', "IP Description")
|
||||
descr1 = OptionDescription("options", "Common configuration", [option1])
|
||||
descr = OptionDescription("ip1", "Simple IP", [descr1])
|
||||
return descr
|
49
tests/dict/data/ip1_frozen.json
Normal file
49
tests/dict/data/ip1_frozen.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.ip": {
|
||||
"type": "ip",
|
||||
"title": "IP Description frozen"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.ip": {
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.ip": {
|
||||
"clearable": true,
|
||||
"remote": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
9
tests/dict/data/ip1_frozen.py
Normal file
9
tests/dict/data/ip1_frozen.py
Normal file
@ -0,0 +1,9 @@
|
||||
from tiramisu.option import IPOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option1 = IPOption('ip', "IP Description frozen", properties=('frozen',))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option1])
|
||||
descr = OptionDescription("ip1_frozen", "Simple IP", [descr1])
|
||||
return descr
|
45
tests/dict/data/mail1.json
Normal file
45
tests/dict/data/mail1.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.mail": {
|
||||
"type": "email",
|
||||
"title": "Mail Description"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.mail": {
|
||||
"clearable": true,
|
||||
"pattern": "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$",
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
10
tests/dict/data/mail1.py
Normal file
10
tests/dict/data/mail1.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
from tiramisu.option import EmailOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = EmailOption('mail', "Mail Description")
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("mail1", "Simple mail", [descr1])
|
||||
return descr
|
45
tests/dict/data/number1.json
Normal file
45
tests/dict/data/number1.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.integer": {
|
||||
"type": "integer",
|
||||
"title": "integer 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.integer": {
|
||||
"clearable": true,
|
||||
"pattern": "^[0-9]+$",
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
10
tests/dict/data/number1.py
Normal file
10
tests/dict/data/number1.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
from tiramisu.option import IntOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = IntOption('integer', "integer 1")
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("number1", "Simple number", [descr1])
|
||||
return descr
|
49
tests/dict/data/number1_frozen.json
Normal file
49
tests/dict/data/number1_frozen.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.integer": {
|
||||
"type": "integer",
|
||||
"title": "integer 1 frozen"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.integer": {
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.integer": {
|
||||
"clearable": true,
|
||||
"pattern": "^[0-9]+$",
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
10
tests/dict/data/number1_frozen.py
Normal file
10
tests/dict/data/number1_frozen.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
from tiramisu.option import IntOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = IntOption('integer', "integer 1 frozen", properties=('frozen',))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("number1_frozen", "Simple number", [descr1])
|
||||
return descr
|
51
tests/dict/data/number1_mod_value.json
Normal file
51
tests/dict/data/number1_mod_value.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.integer": {
|
||||
"type": "integer",
|
||||
"value": 0,
|
||||
"title": "integer 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.integer": {
|
||||
"value": 3,
|
||||
"owner": "user"
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.integer": {
|
||||
"clearable": true,
|
||||
"pattern": "^[0-9]+$",
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
18
tests/dict/data/number1_mod_value.py
Normal file
18
tests/dict/data/number1_mod_value.py
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
from tiramisu.option import IntOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = IntOption('integer', "integer 1", 0)
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("number1_mod_value", "Number with modified value 3 and default value 0", [descr1])
|
||||
return descr
|
||||
|
||||
|
||||
def get_values(api, allpath=False):
|
||||
if allpath:
|
||||
root = 'number1_mod_value.'
|
||||
else:
|
||||
root = ''
|
||||
api.option(root + 'options.integer').value.set(3)
|
50
tests/dict/data/number1_value.json
Normal file
50
tests/dict/data/number1_value.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.integer": {
|
||||
"type": "integer",
|
||||
"value": 0,
|
||||
"title": "integer 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.integer": {
|
||||
"value": 0
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.integer": {
|
||||
"clearable": true,
|
||||
"pattern": "^[0-9]+$",
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
11
tests/dict/data/number1_value.py
Normal file
11
tests/dict/data/number1_value.py
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
from tiramisu.option import IntOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = IntOption('integer', "integer 1", 0)
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("number1_value", "Number with value 0", [descr1])
|
||||
return descr
|
||||
|
1
tests/dict/data/unicode1.dict
Normal file
1
tests/dict/data/unicode1.dict
Normal file
@ -0,0 +1 @@
|
||||
{"options.unicode": null}
|
1
tests/dict/data/unicode1.dict1
Normal file
1
tests/dict/data/unicode1.dict1
Normal file
@ -0,0 +1 @@
|
||||
{"options.unicode": "val"}
|
44
tests/dict/data/unicode1.json
Normal file
44
tests/dict/data/unicode1.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"type": "string",
|
||||
"title": "Unicode 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
5
tests/dict/data/unicode1.mod1
Normal file
5
tests/dict/data/unicode1.mod1
Normal file
@ -0,0 +1,5 @@
|
||||
{"cmd": "config.option('options.unicode').value.set('val')",
|
||||
"body": {"updates": [{"action": "modify",
|
||||
"name": "options.unicode",
|
||||
"value": "val"}]}
|
||||
}
|
11
tests/dict/data/unicode1.py
Normal file
11
tests/dict/data/unicode1.py
Normal file
@ -0,0 +1,11 @@
|
||||
"""just an unicode option
|
||||
"""
|
||||
from tiramisu.option import StrOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = StrOption('unicode', "Unicode 1")
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("unicode1", "Simple unicode", [descr1])
|
||||
return descr
|
3
tests/dict/data/unicode1.updates1
Normal file
3
tests/dict/data/unicode1.updates1
Normal file
@ -0,0 +1,3 @@
|
||||
{"updates": ["options.unicode"],
|
||||
"model": {"options.unicode": {"owner": "user",
|
||||
"value": "val"}}}
|
48
tests/dict/data/unicode1_frozen.json
Normal file
48
tests/dict/data/unicode1_frozen.json
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"type": "string",
|
||||
"title": "Unicode 1 frozen"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode": {
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
11
tests/dict/data/unicode1_frozen.py
Normal file
11
tests/dict/data/unicode1_frozen.py
Normal file
@ -0,0 +1,11 @@
|
||||
"""just an unicode option
|
||||
"""
|
||||
from tiramisu.option import StrOption, OptionDescription
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = StrOption('unicode', "Unicode 1 frozen", properties=('frozen',))
|
||||
descr1 = OptionDescription("options", "Common configuration", [option])
|
||||
descr = OptionDescription("unicode1_frozen", "Simple unicode", [descr1])
|
||||
return descr
|
84
tests/dict/data/unicode1_leader_hidden_followers.json
Normal file
84
tests/dict/data/unicode1_leader_hidden_followers.json
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true,
|
||||
"display": false,
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
15
tests/dict/data/unicode1_leader_hidden_followers.py
Normal file
15
tests/dict/data/unicode1_leader_hidden_followers.py
Normal file
@ -0,0 +1,15 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader", multi=True, properties=('hidden',))
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", multi=True)
|
||||
descr1 = Leadership("unicode", "Common configuration",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration", [descr1])
|
||||
descr = OptionDescription("unicode1_leader_hidden_followers", "Leader follower with unicode and hidden leader", [descr])
|
||||
return descr
|
82
tests/dict/data/unicode1_leadership.json
Normal file
82
tests/dict/data/unicode1_leadership.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
15
tests/dict/data/unicode1_leadership.py
Normal file
15
tests/dict/data/unicode1_leadership.py
Normal file
@ -0,0 +1,15 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription, Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader", multi=True)
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", multi=True)
|
||||
descr1 = Leadership("unicode", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership", "Leader followers with Unicode", [descr])
|
||||
return descr
|
99
tests/dict/data/unicode1_leadership_default_value.json
Normal file
99
tests/dict/data/unicode1_leadership_default_value.json
Normal file
@ -0,0 +1,99 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"value": [
|
||||
"val1",
|
||||
"val2"
|
||||
],
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"defaultmulti": "follower2",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2 with default multi"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true,
|
||||
"value": [
|
||||
"val1",
|
||||
"val2"
|
||||
]
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"0": {
|
||||
"value": "follower2"
|
||||
},
|
||||
"1": {
|
||||
"value": "follower2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
16
tests/dict/data/unicode1_leadership_default_value.py
Normal file
16
tests/dict/data/unicode1_leadership_default_value.py
Normal file
@ -0,0 +1,16 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
from tiramisu.setting import groups
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader", ['val1', 'val2'], multi=True)
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2 with default multi", default_multi="follower2", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", multi=True)
|
||||
descr1 = Leadership("unicode", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_default_value", "Leader followers with unicode with default value", [descr])
|
||||
return descr
|
102
tests/dict/data/unicode1_leadership_hidden.json
Normal file
102
tests/dict/data/unicode1_leadership_hidden.json
Normal file
@ -0,0 +1,102 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2 hidden"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true,
|
||||
"value": [
|
||||
"val1",
|
||||
"val2"
|
||||
],
|
||||
"owner": "user"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"0": {
|
||||
"display": false,
|
||||
"hidden": true,
|
||||
"value": "super",
|
||||
"owner": "user"
|
||||
},
|
||||
"1": {
|
||||
"display": false,
|
||||
"hidden": true
|
||||
},
|
||||
"null": {
|
||||
"display": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
25
tests/dict/data/unicode1_leadership_hidden.py
Normal file
25
tests/dict/data/unicode1_leadership_hidden.py
Normal file
@ -0,0 +1,25 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader", multi=True)
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2 hidden", multi=True, properties=('hidden',))
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", multi=True)
|
||||
descr1 = Leadership("unicode", "Common configuration",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_hidden", "Leader followers with second follower hidden", [descr])
|
||||
return descr
|
||||
|
||||
|
||||
def get_values(api, allpath=False):
|
||||
if allpath:
|
||||
root = 'unicode1_leadership_hidden.'
|
||||
else:
|
||||
root = ''
|
||||
api.option(root + 'options.unicode.unicode').value.set([u'val1', u'val2'])
|
||||
api.option(root + 'options.unicode.unicode2', 0).value.set(u'super')
|
81
tests/dict/data/unicode1_leadership_hidden_all_default.json
Normal file
81
tests/dict/data/unicode1_leadership_hidden_all_default.json
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"type": "string",
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode1": {
|
||||
"properties": {
|
||||
"options.unicode1.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode1.unicode1": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
16
tests/dict/data/unicode1_leadership_hidden_all_default.py
Normal file
16
tests/dict/data/unicode1_leadership_hidden_all_default.py
Normal file
@ -0,0 +1,16 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader")
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", multi=True)
|
||||
descr1 = Leadership("unicode1", "Common configuration",
|
||||
[option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration", [option, descr1])
|
||||
descr = OptionDescription("unicode1_leadership_hidden_all_default", "FIXME...", [descr])
|
||||
return descr
|
96
tests/dict/data/unicode1_leadership_not_equal.json
Normal file
96
tests/dict/data/unicode1_leadership_not_equal.json
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2 not equal"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3 not equal"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"not_equal": [
|
||||
{
|
||||
"options": [
|
||||
"options.unicode.unicode3"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"not_equal": [
|
||||
{
|
||||
"options": [
|
||||
"options.unicode.unicode2"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
17
tests/dict/data/unicode1_leadership_not_equal.py
Normal file
17
tests/dict/data/unicode1_leadership_not_equal.py
Normal file
@ -0,0 +1,17 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader", multi=True)
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2 not equal", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3 not equal", multi=True)
|
||||
option2.impl_add_consistency('not_equal', option3)
|
||||
descr1 = Leadership("unicode", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_not_equal", "Leader followers with follower not equal", [descr])
|
||||
return descr
|
96
tests/dict/data/unicode1_leadership_requires.json
Normal file
96
tests/dict/data/unicode1_leadership_requires.json
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Values 'test' must show 'Unicode follower 3'"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"hide": [
|
||||
"options.unicode.unicode3"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"test": {
|
||||
"show": [
|
||||
"options.unicode.unicode3"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
20
tests/dict/data/unicode1_leadership_requires.py
Normal file
20
tests/dict/data/unicode1_leadership_requires.py
Normal file
@ -0,0 +1,20 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader", multi=True)
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Values 'test' must show 'Unicode follower 3'", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", requires=[{'option': option2,
|
||||
'expected': u'test',
|
||||
'action': 'hidden',
|
||||
'inverse': True}],
|
||||
multi=True)
|
||||
descr1 = Leadership("unicode", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_requires", "Leader followers with Unicode follower 3 hidden when Unicode follower 2 is test", [descr])
|
||||
return descr
|
103
tests/dict/data/unicode1_leadership_requires_all.json
Normal file
103
tests/dict/data/unicode1_leadership_requires_all.json
Normal file
@ -0,0 +1,103 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"type": "string",
|
||||
"title": "Value 'test' must show Leadership"
|
||||
},
|
||||
"options.unicode1": {
|
||||
"properties": {
|
||||
"options.unicode1.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode1": {
|
||||
"display": false,
|
||||
"properties": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"options.unicode1.unicode1": {
|
||||
"required": true,
|
||||
"hidden": true,
|
||||
"display": false
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"hide": [
|
||||
"options.unicode1"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"test": {
|
||||
"show": [
|
||||
"options.unicode1"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode1.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
19
tests/dict/data/unicode1_leadership_requires_all.py
Normal file
19
tests/dict/data/unicode1_leadership_requires_all.py
Normal file
@ -0,0 +1,19 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Value 'test' must show Leadership")
|
||||
option1 = UnicodeOption('unicode1', "Unicode leader", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 1", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 2", multi=True)
|
||||
descr1 = Leadership("unicode1", "Common configuration",
|
||||
[option1, option2, option3], requires=[{'option': option,
|
||||
'expected': u'test',
|
||||
'action': 'hidden',
|
||||
'inverse': True}])
|
||||
descr = OptionDescription("options", "Common configuration", [option, descr1])
|
||||
descr = OptionDescription("unicode1_leadership_requires_all", "Leader follower with requirement", [descr])
|
||||
return descr
|
87
tests/dict/data/unicode1_leadership_requires_follower.json
Normal file
87
tests/dict/data/unicode1_leadership_requires_follower.json
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode1": {
|
||||
"properties": {
|
||||
"options.unicode1.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Values 'test' must show 'Unicode follower 2'"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode1.unicode1": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode1.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"hide": [
|
||||
"options.unicode1.unicode3"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"test": {
|
||||
"show": [
|
||||
"options.unicode1.unicode3"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
19
tests/dict/data/unicode1_leadership_requires_follower.py
Normal file
19
tests/dict/data/unicode1_leadership_requires_follower.py
Normal file
@ -0,0 +1,19 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option1 = UnicodeOption('unicode1', "Values 'test' must show 'Unicode follower 2'", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 1", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 2", multi=True,
|
||||
requires=[{'option': option1,
|
||||
'expected': u'test',
|
||||
'action': 'hidden',
|
||||
'inverse': True}])
|
||||
descr1 = Leadership("unicode1", "Common configuration",
|
||||
[option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_requires_follower", "Leader follower requires follower with leader", [descr])
|
||||
return descr
|
108
tests/dict/data/unicode1_leadership_requires_follower_value.json
Normal file
108
tests/dict/data/unicode1_leadership_requires_follower_value.json
Normal file
@ -0,0 +1,108 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode1": {
|
||||
"properties": {
|
||||
"options.unicode1.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Values 'test' must show 'Unicode follower 2'"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode1.unicode1": {
|
||||
"required": true,
|
||||
"value": [
|
||||
"test",
|
||||
"pas test"
|
||||
],
|
||||
"owner": "user"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"0": {
|
||||
"value": "super1",
|
||||
"owner": "user"
|
||||
}
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"0": {
|
||||
"value": "super1",
|
||||
"owner": "user"
|
||||
},
|
||||
"1": {
|
||||
"display": false,
|
||||
"hidden": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode1.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"hide": [
|
||||
"options.unicode1.unicode3"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"test": {
|
||||
"show": [
|
||||
"options.unicode1.unicode3"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option1 = UnicodeOption('unicode1', "Values 'test' must show 'Unicode follower 2'", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 1", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 2", multi=True,
|
||||
requires=[{'option': option1,
|
||||
'expected': u'test',
|
||||
'action': 'hidden',
|
||||
'inverse': True}])
|
||||
descr1 = Leadership("unicode1", "Common configuration",
|
||||
[option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_requires_follower_value", "Leader follower requires follower with leader value", [descr])
|
||||
return descr
|
||||
|
||||
|
||||
def get_values(api, allpath=False):
|
||||
if allpath:
|
||||
root = 'unicode1_leadership_requires_follower_value.'
|
||||
else:
|
||||
root = ''
|
||||
api.option(root + 'options.unicode1.unicode1').value.set([u'test', u'pas test'])
|
||||
api.option(root + 'options.unicode1.unicode2', 0).value.set(u'super1')
|
||||
api.option(root + 'options.unicode1.unicode3', 0).value.set(u'super1')
|
87
tests/dict/data/unicode1_leadership_requires_followers.json
Normal file
87
tests/dict/data/unicode1_leadership_requires_followers.json
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode1": {
|
||||
"properties": {
|
||||
"options.unicode1.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Values 'test' must show 'Unicode follower 2'"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode1.unicode1": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode1.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"hide": [
|
||||
"options.unicode1.unicode3"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"test": {
|
||||
"show": [
|
||||
"options.unicode1.unicode3"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
19
tests/dict/data/unicode1_leadership_requires_followers.py
Normal file
19
tests/dict/data/unicode1_leadership_requires_followers.py
Normal file
@ -0,0 +1,19 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option1 = UnicodeOption('unicode1', "Unicode leader", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Values 'test' must show 'Unicode follower 2'", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 2", multi=True,
|
||||
requires=[{'option': option2,
|
||||
'expected': u'test',
|
||||
'action': 'hidden',
|
||||
'inverse': True}])
|
||||
descr1 = Leadership("unicode1", "Common configuration",
|
||||
[option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_requires_followers", "Leader follower requires follower with a follower", [descr])
|
||||
return descr
|
103
tests/dict/data/unicode1_leadership_requires_leader.json
Normal file
103
tests/dict/data/unicode1_leadership_requires_leader.json
Normal file
@ -0,0 +1,103 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"type": "string",
|
||||
"title": "Value 'test' must show leader"
|
||||
},
|
||||
"options.unicode1": {
|
||||
"properties": {
|
||||
"options.unicode1.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode1": {
|
||||
"display": false,
|
||||
"properties": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"options.unicode1.unicode1": {
|
||||
"required": true,
|
||||
"hidden": true,
|
||||
"display": false
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"hide": [
|
||||
"options.unicode1"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"test": {
|
||||
"show": [
|
||||
"options.unicode1"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode1.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode1.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
19
tests/dict/data/unicode1_leadership_requires_leader.py
Normal file
19
tests/dict/data/unicode1_leadership_requires_leader.py
Normal file
@ -0,0 +1,19 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Value 'test' must show leader")
|
||||
option1 = UnicodeOption('unicode1', "Unicode leader", multi=True, requires=[{'option': option,
|
||||
'expected': u'test',
|
||||
'action': 'hidden',
|
||||
'inverse': True}])
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 1", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 2", multi=True)
|
||||
descr1 = Leadership("unicode1", "Common configuration",
|
||||
[option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration", [option, descr1])
|
||||
descr = OptionDescription("unicode1_leadership_requires_leader", "Leader follower with requirement on leader", [descr])
|
||||
return descr
|
129
tests/dict/data/unicode1_leadership_requires_value.json
Normal file
129
tests/dict/data/unicode1_leadership_requires_value.json
Normal file
@ -0,0 +1,129 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Values 'test' must show 'Unicode follower 3'"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 2"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true,
|
||||
"value": [
|
||||
"test",
|
||||
"val2"
|
||||
],
|
||||
"owner": "user"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"0": {
|
||||
"value": "super1",
|
||||
"owner": "user"
|
||||
},
|
||||
"1": {
|
||||
"value": "super2",
|
||||
"owner": "user"
|
||||
}
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"0": {
|
||||
"value": "pas test",
|
||||
"owner": "user"
|
||||
},
|
||||
"1": {
|
||||
"value": "test",
|
||||
"owner": "user"
|
||||
}
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"1": {
|
||||
"display": false,
|
||||
"hidden": true,
|
||||
"value": "super",
|
||||
"owner": "user"
|
||||
}
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input",
|
||||
"dependencies": {
|
||||
"default": {
|
||||
"hide": [
|
||||
"options.unicode.unicode3"
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"test": {
|
||||
"show": [
|
||||
"options.unicode.unicode3"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
33
tests/dict/data/unicode1_leadership_requires_value.py
Normal file
33
tests/dict/data/unicode1_leadership_requires_value.py
Normal file
@ -0,0 +1,33 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Values 'test' must show 'Unicode follower 3'", multi=True)
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2", multi=True)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", requires=[{'option': option,
|
||||
'expected': u'test',
|
||||
'action': 'hidden',
|
||||
'inverse': True}],
|
||||
multi=True)
|
||||
descr1 = Leadership("unicode", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_requires_value", "Leader followers with Unicode follower 3 hidden when Unicode follower 2 is test and modified value", [descr])
|
||||
return descr
|
||||
|
||||
|
||||
def get_values(api, allpath=False):
|
||||
if allpath:
|
||||
root = 'unicode1_leadership_requires_value.'
|
||||
else:
|
||||
root = ''
|
||||
api.option(root + 'options.unicode.unicode').value.set([u'test', u'val2'])
|
||||
api.option(root + 'options.unicode.unicode1', 0).value.set(u'super1')
|
||||
api.option(root + 'options.unicode.unicode1', 1).value.set(u'super2')
|
||||
api.option(root + 'options.unicode.unicode2', 0).value.set(u'pas test')
|
||||
api.option(root + 'options.unicode.unicode2', 1).value.set(u'test')
|
||||
api.option(root + 'options.unicode.unicode3', 1).value.set(u'super')
|
83
tests/dict/data/unicode1_leadership_submulti.json
Normal file
83
tests/dict/data/unicode1_leadership_submulti.json
Normal file
@ -0,0 +1,83 @@
|
||||
{
|
||||
"schema": {
|
||||
"options": {
|
||||
"properties": {
|
||||
"options.unicode": {
|
||||
"properties": {
|
||||
"options.unicode.unicode": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode leader"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 1"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"isSubMulti": true,
|
||||
"title": "Unicode follower 2 submulti"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"type": "string",
|
||||
"isMulti": true,
|
||||
"title": "Unicode follower 3"
|
||||
}
|
||||
},
|
||||
"type": "array",
|
||||
"title": "Common configuration 1"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "Common configuration 2"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"options.unicode.unicode": {
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"owner": "user",
|
||||
"properties": [
|
||||
"cache",
|
||||
"demoting_error_warning",
|
||||
"disabled",
|
||||
"force_store_value",
|
||||
"frozen",
|
||||
"hidden",
|
||||
"validator",
|
||||
"warnings"
|
||||
],
|
||||
"permissives": [
|
||||
"hidden"
|
||||
]
|
||||
},
|
||||
"form": {
|
||||
"options.unicode.unicode": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode1": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode2": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"options.unicode.unicode3": {
|
||||
"clearable": true,
|
||||
"type": "input"
|
||||
},
|
||||
"null": [
|
||||
{
|
||||
"title": "Configurer",
|
||||
"type": "submit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": "1.0"
|
||||
}
|
17
tests/dict/data/unicode1_leadership_submulti.py
Normal file
17
tests/dict/data/unicode1_leadership_submulti.py
Normal file
@ -0,0 +1,17 @@
|
||||
from tiramisu.option import UnicodeOption, OptionDescription, submulti
|
||||
from tiramisu import Leadership
|
||||
|
||||
|
||||
def get_description():
|
||||
"""generate description for this test
|
||||
"""
|
||||
option = UnicodeOption('unicode', "Unicode leader", multi=True)
|
||||
option1 = UnicodeOption('unicode1', "Unicode follower 1", multi=True)
|
||||
option2 = UnicodeOption('unicode2', "Unicode follower 2 submulti", multi=submulti)
|
||||
option3 = UnicodeOption('unicode3', "Unicode follower 3", multi=True)
|
||||
descr1 = Leadership("unicode", "Common configuration 1",
|
||||
[option, option1, option2, option3])
|
||||
descr = OptionDescription("options", "Common configuration 2", [descr1])
|
||||
descr = OptionDescription("unicode1_leadership_submulti", "Leader followers with submulti Unicode", [descr])
|
||||
return descr
|
||||
|
4
tests/dict/data/unicode1_leadership_value.dict
Normal file
4
tests/dict/data/unicode1_leadership_value.dict
Normal file
@ -0,0 +1,4 @@
|
||||
{"options.unicode.unicode": ["val3", "val4"],
|
||||
"options.unicode.unicode1": ["super1", "super2"],
|
||||
"options.unicode.unicode2": ["pas test", "test"],
|
||||
"options.unicode.unicode3": [null, "super"]}
|
4
tests/dict/data/unicode1_leadership_value.dict1
Normal file
4
tests/dict/data/unicode1_leadership_value.dict1
Normal file
@ -0,0 +1,4 @@
|
||||
{"options.unicode.unicode": ["val1", "val2"],
|
||||
"options.unicode.unicode1": [null, null],
|
||||
"options.unicode.unicode2": ["follower2", "follower2"],
|
||||
"options.unicode.unicode3": [null, null]}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user