Commit bf0a339a authored by Emmy Vouriot's avatar Emmy Vouriot Committed by Jérome Perrin

fix test bytes to str when concat with str

parent bb3cea3e
......@@ -403,7 +403,7 @@ return json.dumps({
self.assertEqual(404, result[u"status"])
self.assertEqual(u"API-DOCUMENT-NOT-FOUND", result[u"name"])
self.assertEqual(u"Document has not been found", result[u"message"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-DOCUMENT-NOT-FOUND")
self.assertEqual(error_record.getDescription(), "Document has not been found")
self.assertEqual(error_record.getTextContent(), json_payload)
......@@ -424,7 +424,7 @@ return json.dumps({
self.assertEqual(400, result[u"status"])
self.assertEqual(u"API-JSON-NO-ID-PROPERTY", result[u"name"])
self.assertEqual(u"Cannot find id property", result[u"message"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-JSON-NO-ID-PROPERTY")
self.assertEqual(error_record.getDescription(), "Cannot find id property")
self.assertEqual(error_record.getTextContent(), json_payload)
......@@ -447,9 +447,9 @@ return json.dumps({
self.action_type_dict["get"], person.getRelativeUrl())
self.assertEqual(u"API-NO-ACTION-FOUND", result[u"name"])
self.assertEqual(message, result[u"message"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-NO-ACTION-FOUND")
self.assertEqual(error_record.getDescription(), message.encode())
self.assertEqual(error_record.getDescription(), (message.encode() if six.PY2 else message))
self.assertEqual(error_record.getTextContent(), json_payload)
def test_action_get_bad_json(self):
......@@ -513,7 +513,7 @@ return json.dumps({
self.assertEqual(404, result[u"status"])
self.assertEqual(u"API-DOCUMENT-NOT-FOUND", result[u"name"])
self.assertEqual(u"Document has not been found", result[u"message"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-DOCUMENT-NOT-FOUND")
self.assertEqual(error_record.getDescription(), "Document has not been found")
self.assertEqual(error_record.getTextContent(), json_payload)
......@@ -533,7 +533,7 @@ return json.dumps({
self.assertEqual(400, result[u"status"])
self.assertEqual(u"API-JSON-NO-ID-PROPERTY", result[u"name"])
self.assertEqual(u"Cannot find id property", result[u"message"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-JSON-NO-ID-PROPERTY")
self.assertEqual(error_record.getDescription(), "Cannot find id property")
self.assertEqual(error_record.getTextContent(), json_payload)
......@@ -555,9 +555,9 @@ return json.dumps({
self.action_type_dict["put"], person.getRelativeUrl())
self.assertEqual(u"API-NO-ACTION-FOUND", result[u"name"])
self.assertEqual(message, result[u"message"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-NO-ACTION-FOUND")
self.assertEqual(error_record.getDescription(), message.encode())
self.assertEqual(error_record.getDescription(), (message.encode() if six.PY2 else message))
self.assertEqual(error_record.getTextContent(), json_payload)
def test_action_put_bad_json(self):
......@@ -697,7 +697,7 @@ return json.dumps({
self.assertEqual(u"API-NO-ACTION-FOUND", result[u"name"])
self.assertEqual(message, result[u"message"])
self.assertEqual(details_list, result[u"details"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-NO-ACTION-FOUND")
self.assertEqual(error_record.getTextContent(), json_payload)
......@@ -728,7 +728,7 @@ return json.dumps({
self.assertEqual(u"API-NO-ACTION-FOUND", result[u"name"])
self.assertEqual(message, result[u"message"])
self.assertEqual(details_list, result[u"details"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-NO-ACTION-FOUND")
self.assertEqual(error_record.getTextContent(), json_payload)
......@@ -981,7 +981,7 @@ return [{
self.assertEqual(u"API-NO-ACTION-FOUND", result[u"name"])
self.assertEqual(message, result[u"message"])
self.assertEqual(details, result[u"details"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-NO-ACTION-FOUND")
self.assertEqual(error_record.getTextContent(), json_payload)
......@@ -1012,7 +1012,7 @@ return [{
self.assertEqual(u"API-NO-ACTION-FOUND", result[u"name"])
self.assertEqual(message, result[u"message"])
self.assertEqual(details_list, result[u"details"])
error_record = self.portal.restrictedTraverse("error_record_module/" + result[u"debug_id"].encode())
error_record = self.portal.restrictedTraverse("error_record_module/" + (result[u"debug_id"].encode() if six.PY2 else result["debug_id"]))
self.assertEqual(error_record.getTitle(), "API-NO-ACTION-FOUND")
self.assertEqual(error_record.getTextContent(), json_payload)
......
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