mirror of
https://github.com/PretendoNetwork/miiverse-api.git
synced 2024-05-18 12:50:41 -04:00
Updated community test case to also validate error response formatting
This commit is contained in:
parent
8651e8cfd7
commit
dbd8f44831
|
@ -420,7 +420,7 @@
|
|||
{
|
||||
"listen": "prerequest",
|
||||
"script": {
|
||||
"id": "ab6f4437-0090-4f7e-a72e-36c1db11a5a7",
|
||||
"id": "64933ef4-dc38-4d6f-a8c5-54b93decd369",
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
""
|
||||
|
@ -430,7 +430,7 @@
|
|||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"id": "095ce2df-1f5a-4fcf-b4d4-c3b7616d3baa",
|
||||
"id": "f00757f9-3faf-40da-89ff-0f3fb356678f",
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
"const headerSchema = {",
|
||||
|
@ -468,9 +468,55 @@
|
|||
" ]",
|
||||
"};",
|
||||
"",
|
||||
"const errorSchema = {",
|
||||
" \"type\": \"object\",",
|
||||
" \"properties\": {",
|
||||
" \"result\": {",
|
||||
" \"type\": \"object\",",
|
||||
" \"properties\": {",
|
||||
" \"has_error\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"maxLength\": 1",
|
||||
" },",
|
||||
" \"version\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"maxLength\": 1",
|
||||
" },",
|
||||
" \"code\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"maxLength\": 3",
|
||||
" },",
|
||||
" \"error_code\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"maxLength\": 4",
|
||||
" },",
|
||||
" \"message\": {",
|
||||
" \"type\": \"string\"",
|
||||
" }",
|
||||
" },",
|
||||
" \"required\": [",
|
||||
" \"has_error\",",
|
||||
" \"version\",",
|
||||
" \"code\",",
|
||||
" \"error_code\",",
|
||||
" \"message\"",
|
||||
" ]",
|
||||
" },",
|
||||
"",
|
||||
" },",
|
||||
" \"required\": [",
|
||||
" \"result\"",
|
||||
" ]",
|
||||
"};",
|
||||
"",
|
||||
"pm.test(\"Valid XML Response Header\", function () {",
|
||||
" var json = xml2Json(pm.response.text());",
|
||||
" pm.expect(json).to.have.jsonSchema(headerSchema);",
|
||||
" console.log(pm.response.code);",
|
||||
" if(pm.response.code === 200)",
|
||||
" pm.expect(json).to.have.jsonSchema(headerSchema);",
|
||||
" else ",
|
||||
" pm.expect(json).to.have.jsonSchema(errorSchema);",
|
||||
" ",
|
||||
"})"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue