233 'cardinality': u'?1'}), |
233 'cardinality': u'?1'}), |
234 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
234 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
235 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
235 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
236 {'x': None, |
236 {'x': None, |
237 'ct': u'SizeConstraint_eid', |
237 'ct': u'SizeConstraint_eid', |
238 'value': u'{"max": 2, "min": null}'}), |
238 'value': u'{"max": 2, "min": null, "msg": null}'}), |
239 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
239 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
240 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
240 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
241 {'x': None, |
241 {'x': None, |
242 'ct': u'StaticVocabularyConstraint_eid', |
242 'ct': u'StaticVocabularyConstraint_eid', |
243 'value': u'["?1", "11"]'}), |
243 'value': u'{"msg": null, "values": ["?1", "11"]}'}), |
244 |
244 |
245 ('INSERT CWAttribute X: X cardinality %(cardinality)s,X defaultval %(defaultval)s,' |
245 ('INSERT CWAttribute X: X cardinality %(cardinality)s,X defaultval %(defaultval)s,' |
246 'X description %(description)s,X formula %(formula)s,X fulltextindexed %(fulltextindexed)s,' |
246 'X description %(description)s,X formula %(formula)s,X fulltextindexed %(fulltextindexed)s,' |
247 'X indexed %(indexed)s,X internationalizable %(internationalizable)s,' |
247 'X indexed %(indexed)s,X internationalizable %(internationalizable)s,' |
248 'X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE ' |
248 'X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE ' |
260 'cardinality': u'?1'}), |
260 'cardinality': u'?1'}), |
261 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
261 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
262 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
262 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
263 {'x': None, |
263 {'x': None, |
264 'ct': u'SizeConstraint_eid', |
264 'ct': u'SizeConstraint_eid', |
265 'value': u'{"max": 2, "min": null}'}), |
265 'value': u'{"max": 2, "min": null, "msg": null}'}), |
266 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
266 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
267 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
267 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
268 {'x': None, |
268 {'x': None, |
269 'ct': u'StaticVocabularyConstraint_eid', |
269 'ct': u'StaticVocabularyConstraint_eid', |
270 "value": (u'["?*", "1*", "+*", "**", "?+", "1+", "++", "*+", "?1", ' |
270 "value": (u'{"msg": null, "values": ["?*", "1*", "+*", "**", "?+", "1+", "++", "*+", "?1", ' |
271 u'"11", "+1", "*1", "??", "1?", "+?", "*?"]')})], |
271 u'"11", "+1", "*1", "??", "1?", "+?", "*?"]}')})], |
272 list(rschema2rql(schema.rschema('cardinality'), cstrtypemap))) |
272 list(rschema2rql(schema.rschema('cardinality'), cstrtypemap))) |
273 |
273 |
274 def test_rschema2rql_custom_type(self): |
274 def test_rschema2rql_custom_type(self): |
275 expected = [('INSERT CWRType X: X description %(description)s,X final %(final)s,' |
275 expected = [('INSERT CWRType X: X description %(description)s,X final %(final)s,' |
276 'X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,' |
276 'X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,' |
326 'formula': None, |
326 'formula': None, |
327 'cardinality': u'?1'}), |
327 'cardinality': u'?1'}), |
328 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
328 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
329 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
329 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
330 {'x': None, |
330 {'x': None, |
331 'value': u'None', |
331 'value': u'{"msg": null, "values": ["text/rest", "text/markdown", ' |
|
332 '"text/html", "text/plain"]}', |
332 'ct': 'FormatConstraint_eid'}), |
333 'ct': 'FormatConstraint_eid'}), |
333 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
334 ('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
334 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
335 'WHERE CT eid %(ct)s, EDEF eid %(x)s', |
335 {'x': None, |
336 {'x': None, |
336 'value': u'{"max": 50, "min": null}', |
337 'value': u'{"max": 50, "min": null, "msg": null}', |
337 'ct': 'SizeConstraint_eid'})], |
338 'ct': 'SizeConstraint_eid'})], |
338 list(rdef2rql(schema['description_format'].rdefs[('CWRType', 'String')], |
339 list(rdef2rql(schema['description_format'].rdefs[('CWRType', 'String')], |
339 cstrtypemap))) |
340 cstrtypemap))) |
340 |
341 |
341 def test_updateeschema2rql1(self): |
342 def test_updateeschema2rql1(self): |