Commit 9d239999 authored by Jérome Perrin's avatar Jérome Perrin

json_form: py3

parent bbff0a45
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
import json import json
from DateTime import DateTime from DateTime import DateTime
import six
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
...@@ -149,7 +150,9 @@ return json.dumps({ ...@@ -149,7 +150,9 @@ return json.dumps({
self.fixJSONForm(method, schema, after_method) self.fixJSONForm(method, schema, after_method)
self.tic() self.tic()
self.assertRaises(ValueError, getattr(self.portal, method), json_data, list_error=True) self.assertRaises(ValueError, getattr(self.portal, method), json_data, list_error=True)
error = {"my-schema.json": [[u"Validation Error", u"'2' is not of type u'integer'"], [u"Validation Error", u"2 is not of type u'string'"]]} error = {"my-schema.json": [["Validation Error", "'2' is not of type 'integer'"], ["Validation Error", "2 is not of type 'string'"]]}
if six.PY2:
error = {"my-schema.json": [[u"Validation Error", u"'2' is not of type u'integer'"], [u"Validation Error", u"2 is not of type u'string'"]]}
try: try:
getattr(self.portal, method)(json_data, list_error=True) getattr(self.portal, method)(json_data, list_error=True)
raise ValueError("No error raised during processing") raise ValueError("No error raised during processing")
...@@ -205,9 +208,15 @@ return json.dumps({ ...@@ -205,9 +208,15 @@ return json.dumps({
self.assertRaises(ValueError, getattr(self.portal, method), json_data, list_error=True) self.assertRaises(ValueError, getattr(self.portal, method), json_data, list_error=True)
error = { error = {
"my-schema.json": [[ "my-schema.json": [[
"Validation Error", u"'2018-11-13T20:20:67' is not a u'date-time'" "Validation Error", u"'2018-11-13T20:20:67' is not a 'date-time'"
]] ]]
} }
if six.PY2:
error = {
"my-schema.json": [[
"Validation Error", u"'2018-11-13T20:20:67' is not a u'date-time'"
]]
}
try: try:
getattr(self.portal, method)(json_data, list_error=True) getattr(self.portal, method)(json_data, list_error=True)
raise ValueError("No error raised during processing") raise ValueError("No error raised during processing")
......
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