Commit 2caa6eca authored by Rafael Monnerat's avatar Rafael Monnerat

Raise on duplicated entries on software.cfg.json

See merge request nexedi/slapos.core!609
parents 1b7de85f c3d400ef
Pipeline #33505 failed with stage
in 0 seconds
...@@ -30,13 +30,6 @@ ...@@ -30,13 +30,6 @@
} }
rJS(window) rJS(window)
.declareMethod("getBaseUrl", function (url) {
var base_url, url_uri = URI(url);
base_url = url_uri.path().split("/");
base_url.pop();
base_url = url.split(url_uri.path())[0] + base_url.join("/");
return base_url;
})
.declareMethod("loadJSONSchema", function (url, serialisation) { .declareMethod("loadJSONSchema", function (url, serialisation) {
var meta_schema_url = "slapos_load_meta_schema.json"; var meta_schema_url = "slapos_load_meta_schema.json";
...@@ -77,25 +70,26 @@ ...@@ -77,25 +70,26 @@
throw new Error("Non valid JSON for software.cfg.json:" + software_cfg_json); throw new Error("Non valid JSON for software.cfg.json:" + software_cfg_json);
} }
return software_json; return software_json;
});
});
}) })
.push(function (software_json) {
.declareMethod("validateJSON", function (base_url, schema_url, generated_json) { // Ensure you dont have duplicated entries
var parameter_schema_url = schema_url; var index, entry_list = [], shared, software_type;
for (index in software_json['software-type']) {
if (URI(parameter_schema_url).protocol() === "") { if (software_json['software-type'].hasOwnProperty(index)) {
if (base_url !== undefined) { shared = software_json['software-type'][index].shared ? true : false;
parameter_schema_url = base_url + "/" + parameter_schema_url; software_type = software_json['software-type'][index]['software-type'];
if (software_type === undefined) {
software_type = index;
} }
if (entry_list.includes(software_type + "@" + shared)) {
throw new Error("Non valid JSON for software.cfg.json, duplicated entry (" +
software_type + ", shared: " + shared + "):" + software_cfg_json);
} }
entry_list.push(software_type + "@" + shared);
return new RSVP.Queue() }
.push(function () { }
return $RefParser.dereference(parameter_schema_url); return software_json;
}) });
.push(function (schema) {
return new Validator(schema, '7', false).validate(generated_json);
}); });
}); });
}(window, rJS, RSVP, btoa, URI, Validator, jIO, JSON, $RefParser)); }(window, rJS, RSVP, btoa, URI, Validator, jIO, JSON, $RefParser));
\ No newline at end of file
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
</fieldset> </fieldset>
<fieldset id="parameter-optional"> </fieldset> <fieldset id="parameter-optional"> </fieldset>
<fieldset id="parameter-xml"> <fieldset id="parameter-xml">
<input type=hidden name="parameter_hash" class="parameter_hash_output">
<input type=hidden name="shared" class="parameter_shared"> <input type=hidden name="shared" class="parameter_shared">
<input type=hidden name="schema_url" class="parameter_schema_url"> <input type=hidden name="schema_url" class="parameter_schema_url">
</fieldset> </fieldset>
......
/*jslint nomen: true, maxlen: 200, indent: 2, unparam: true*/ /*jslint nomen: true, maxlen: 200, indent: 2, unparam: true*/
/*global rJS, console, window, btoa, atob, XMLSerializer, /*global rJS, console, window, XMLSerializer,
DOMParser, URI, vkbeautify, domsugar, Boolean */ DOMParser, URI, vkbeautify, domsugar, Boolean */
(function (window, rJS, XMLSerializer, DOMParser, vkbeautify, (function (window, rJS, XMLSerializer, DOMParser, vkbeautify,
...@@ -138,16 +138,11 @@ ...@@ -138,16 +138,11 @@
return {}; return {};
}) })
.push(function (json_dict) { .push(function (json_dict) {
var parameter_hash_input = g.element.querySelectorAll('.parameter_hash_output')[0], var serialisation_type = getSerialisationTypeFromForm(g.element);
serialisation_type = getSerialisationTypeFromForm(g.element),
xml_output;
if (serialisation_type === "json-in-xml") { if (serialisation_type === "json-in-xml") {
xml_output = jsonDictToParameterJSONInXML(json_dict); return jsonDictToParameterJSONInXML(json_dict);
} else {
xml_output = jsonDictToParameterXML(json_dict);
} }
parameter_hash_input.value = btoa(xml_output); return jsonDictToParameterXML(json_dict);
return xml_output;
}); });
} }
...@@ -513,15 +508,8 @@ ...@@ -513,15 +508,8 @@
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var restricted_softwaretype = false, var restricted_softwaretype = false,
software_type_list = [], software_type_list = [],
parameter_hash = options.parameter_hash,
// XXX Do we directly get parameter_xml parameter?
parameter_xml = options.parameter_xml; parameter_xml = options.parameter_xml;
if (parameter_hash !== undefined) {
// A JSON where provided via gadgetfield
parameter_xml = atob(parameter_hash);
}
if (options.software_type_list !== undefined) { if (options.software_type_list !== undefined) {
software_type_list = options.software_type_list; software_type_list = options.software_type_list;
} }
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
var doc = result[1], var doc = result[1],
parameter_dict = { parameter_dict = {
'json_url': doc.url_string.split('?')[0] + ".json", 'json_url': doc.url_string.split('?')[0] + ".json",
'parameter_hash': btoa('<?xml version="1.0" encoding="utf-8" ?><instance/>') 'parameter_xml': '<?xml version="1.0" encoding="utf-8" ?><instance/>'
}; };
if (options.software_type) { if (options.software_type) {
parameter_dict['softwaretype'] = options.software_type; parameter_dict['softwaretype'] = options.software_type;
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.44014.55766.17408</string> </value> <value> <string>1013.8728.41822.8550</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -303,7 +303,7 @@ ...@@ -303,7 +303,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1692989933.58</float> <float>1709839049.13</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -231,10 +231,10 @@ ...@@ -231,10 +231,10 @@
'json_url': gadget.state.doc.url_string.split('?')[0] + ".json", 'json_url': gadget.state.doc.url_string.split('?')[0] + ".json",
'softwaretype': gadget.state.doc.source_reference, 'softwaretype': gadget.state.doc.source_reference,
'shared': gadget.state.doc.root_slave ? 1 : 0, 'shared': gadget.state.doc.root_slave ? 1 : 0,
'parameter_hash': btoa('<?xml version="1.0" encoding="utf-8" ?><instance></instance>') 'parameter_xml': '<?xml version="1.0" encoding="utf-8" ?><instance></instance>'
}; };
if (gadget.state.doc.text_content !== undefined) { if (gadget.state.doc.text_content !== undefined) {
parameter_dict.parameter_hash = btoa(gadget.state.doc.text_content); parameter_dict.parameter_xml = gadget.state.doc.text_content;
} }
return gadget.getSetting("hateoas_url") return gadget.getSetting("hateoas_url")
.push(function (url) { .push(function (url) {
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.44015.51861.27016</string> </value> <value> <string>1013.8728.41822.8550</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1692924255.67</float> <float>1709839708.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
]); ]);
}) })
.push(function (result) { .push(function (result) {
var parameter_hash, var parameter_xml,
parameter_dict, parameter_dict,
default_url; default_url;
...@@ -101,13 +101,14 @@ ...@@ -101,13 +101,14 @@
default_url = gadget.state.url_string; default_url = gadget.state.url_string;
} }
if (gadget.state.parameter_output === undefined) { if (gadget.state.parameter_output === undefined) {
parameter_hash = btoa('<?xml version="1.0" encoding="utf-8" ?><instance></instance>'); parameter_xml = '<?xml version="1.0" encoding="utf-8" ?><instance></instance>';
} else { } else {
parameter_hash = btoa(gadget.state.parameter_output); parameter_xml = gadget.state.parameter_output;
} }
parameter_dict = { parameter_dict = {
'json_url': gadget.state.url_string.split('?')[0] + ".json", 'json_url': gadget.state.url_string.split('?')[0] + ".json",
'parameter_hash': parameter_hash 'parameter_xml': parameter_xml,
'software_type_list': []
}; };
if (gadget.state.software_type_list) { if (gadget.state.software_type_list) {
parameter_dict.software_type_list = gadget.state.software_type_list.split(','); parameter_dict.software_type_list = gadget.state.software_type_list.split(',');
...@@ -167,7 +168,7 @@ ...@@ -167,7 +168,7 @@
"your_parameter_hash": { "your_parameter_hash": {
"description": "", "description": "",
"title": "Parameters Hash", "title": "Parameters Hash",
"default": parameter_hash, "default": btoa(parameter_xml),
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 0, "editable": 0,
......
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.42602.14389.54903</string> </value> <value> <string>1013.8728.41822.8550</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1692903464.84</float> <float>1709840043.97</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
]); ]);
}) })
.push(function (result) { .push(function (result) {
var parameter_hash, var parameter_xml,
parameter_dict, parameter_dict,
default_url; default_url;
...@@ -107,13 +107,13 @@ ...@@ -107,13 +107,13 @@
default_url = gadget.state.url_string; default_url = gadget.state.url_string;
} }
if (gadget.state.parameter_output === undefined) { if (gadget.state.parameter_output === undefined) {
parameter_hash = btoa('<?xml version="1.0" encoding="utf-8" ?><instance></instance>'); parameter_xml = '<?xml version="1.0" encoding="utf-8" ?><instance></instance>';
} else { } else {
parameter_hash = btoa(gadget.state.parameter_output); parameter_xml = gadget.state.parameter_output;
} }
parameter_dict = { parameter_dict = {
'json_url': gadget.state.url_string.split('?')[0] + ".json", 'json_url': gadget.state.url_string.split('?')[0] + ".json",
'parameter_hash': parameter_hash, 'parameter_xml': parameter_xml,
'softwaretype': gadget.state.software_type, 'softwaretype': gadget.state.software_type,
'restricted_softwaretype': false 'restricted_softwaretype': false
}; };
......
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.44012.38164.19575</string> </value> <value> <string>1015.4369.46609.36078</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1692982452.93</float> <float>1709839844.0</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>minimal_duplicated_software_type</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Sample paremeters for a Simple Demo",
"properties": {
"simple-string": {
"title": "Example of Simple String",
"description": "Example of Simple String",
"type": "string",
"default": "Simple string "
},
"simple-integer": {
"title": "Example of Simple Integer",
"description": "Example of Simple Integer",
"type": "integer",
"default": 1
}
}
}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>instance-input-schema.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/x-json</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Sample paremeters for a Simple Demo under json-in-xml",
"properties": {
"simple-string-y": {
"title": "Another String Y",
"description": "Example of Simple String",
"type": "string",
"default": "Y0"
},
"simple-integer-x": {
"title": "Another String X",
"description": "Example of Simple Integer",
"type": "integer",
"default": "X0"
}
}
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>instance-shared-duplicated-input-schema.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/x-json</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Sample paremeters for a Simple Demo under json-in-xml",
"properties": {
"simple-string-in-json": {
"title": "Another string on JSON",
"description": "Example of Simple String",
"type": "string",
"default": "Simple string "
},
"simple-integer-in-json": {
"title": "Another Integer on JSON",
"description": "Example of Simple Integer",
"type": "integer",
"default": 1
}
}
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>instance-shared-input-schema.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/x-json</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"name": "Simple Demo",
"description": "Demo Simple",
"serialisation": "xml",
"software-type": {
"default": {
"title": "Default",
"description": "Default reference parameters",
"request": "instance-input-schema.json",
"response": "instance-output-schema.json",
"index": 0
},
"default-shared": {
"title": "Default Shared",
"description": "Default shared",
"request": "instance-shared-input-schema.json",
"response": "instance-output-schema.json",
"software-type": "default",
"shared": true,
"index": 1
},
"default-shared-duplicated": {
"title": "Duplicated another shared",
"description": "Default shared",
"request": "instance-shared-duplicated-input-schema.json",
"response": "instance-output-schema.json",
"software-type": "default",
"shared": true,
"index": 2
}
}
}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>software.cfg.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/x-json</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>software.cfg</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSlapOSJSTestParameterEditorDuplicatedSoftwareType</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test Form don't render if there are duplicated entries on software.cfg.json </title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">Test Parameter editor (Duplicated Software Type)</td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/init" />
<tr>
<td colspan="3"><b> Set URL for the software release </b></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='url_string']</td>
<td>${base_url}/web_site_module/hostingjs/hateoas/sample-software-schema/minimal_duplicated_software_type/software.cfg</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@name="text_content" and contains(text(), '&lt;instance&gt;&lt;/instance&gt;')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content" and contains(text(), '&lt;instance&gt;&lt;/instance&gt;')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="error"]//span[@class="error_msg" and contains(text(), "Non valid JSON for software.cfg.json, duplicated entry")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@class="error"]//span[@class="error_msg" and contains(text(), "Non valid JSON for software.cfg.json, duplicated entry")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@name="text_content" and contains(text(), '&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content" and contains(text(), '&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content" and contains(text(), '&lt;instance&gt;&lt;/instance&gt;')]</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>500</td>
<td>500</td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;instance&gt;&lt;parameter id=&quot;_&quot;&gt;{&quot;simple-string-in-json&quot;: &quot;1024&quot;}&lt;/parameter&gt;&lt;/instance&gt;</td>
</tr>
<tr>
<td>assertValue</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;instance&gt;&lt;parameter id=&quot;_&quot;&gt;{&quot;simple-string-in-json&quot;: &quot;1024&quot;}&lt;/parameter&gt;&lt;/instance&gt;</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/click_proceed_and_wait_for_hash" />
<tr>
<td>waitForTextPresent</td>
<td>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+PGluc3RhbmNlPjxwYXJhbWV0ZXIgaWQ9Il8iPnsic2ltcGxlLXN0cmluZy1pbi1qc29uIjogIjEwMjQifTwvcGFyYW1ldGVyPjwvaW5zdGFuY2U+</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSlapOSJSTestParameterEditorInvalidEnumParameter</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Parameter editor Change Serialisation </title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">Test Parameter editor (Change Serialisation)</td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/init" />
<tr>
<td colspan="3"><b> Set URL for the software release </b></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='url_string']</td>
<td>${base_url}/web_site_module/hostingjs/hateoas/sample-software-schema/simpledemo/software.cfg</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/wait_software_type_selection_default" />
<tal:block tal:define="name python:'root[simple-numeric-integer]'">
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/wait_for_input_text" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/show_raw_parameter" />
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@name="text_content" and contains(text(), '&lt;instance/&gt;')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content" and contains(text(), '&lt;instance/&gt;')]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;&lt;instance&gt;&lt;parameter id=&quot;simple-string-with-enum-required&quot;&gt;Some Random String&lt;/parameter&gt;&lt;parameter id=&quot;simple-boolean&quot;&gt;Not true&lt;/parameter&gt;&lt;/instance&gt;</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/show_form_parameter" />
<tal:block tal:define="name python:'root[simple-string-with-enum-required]'">
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/wait_for_input_select" />
</tal:block>
<tr>
<td>assertValue</td>
<td>//select[@name="root[simple-string-with-enum-required]"]</td>
<td>Some Random String</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-schemapath="root.simple-string-with-enum-required"]//p[@class="invalid-feedback" and contains(text(), "Value must be one of the enumerated values.")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-schemapath="root.simple-string-with-enum-required"]//p[@class="invalid-feedback" and contains(text(), "Value must be one of the enumerated values.")]</td>
<td></td>
</tr>
<tal:block tal:define="name python:'root[simple-boolean]'">
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/wait_for_input_select" />
</tal:block>
<tr>
<td>assertValue</td>
<td>//select[@name="root[simple-boolean]"]</td>
<td>Not true</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-schemapath="root.simple-boolean"]//p[@class="invalid-feedback" and contains(text(), "Value must be of type boolean.")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-schemapath="root.simple-boolean"]//p[@class="invalid-feedback" and contains(text(), "Value must be of type boolean.")]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSParameterCommonTemplate/macros/click_proceed_and_wait_for_hash" />
<tr>
<td>waitForTextPresent</td>
<td>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGluc3RhbmNlPgogICAgPHBhcmFtZXRlciBpZ</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGluc3RhbmNlPgogICAgPHBhcmFtZXRlciBpZD0ic2ltcGxlLXN0cmluZy13aXRoLWVudW0tcmVxdWlyZWQiPlNvbWUgUmFuZG9tIFN0cmluZzwvcGFyYW1ldGVyPgogICAgPHBhcmFtZXRlciBpZD0ic2ltcGxlLWJvb2xlYW4iPk5vdCB0cnVlPC9wYXJhbWV0ZXI+CjwvaW5zdGFuY2U+</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment