Commit 5feefcc8 authored by Siebers, Michael's avatar Siebers, Michael
Browse files

updated wrong payload/content tests

parent 668ba70f
......@@ -136,6 +136,9 @@
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"method": "POST",
"header": [
......@@ -157,6 +160,181 @@
}
},
"response": []
},
{
"name": "No Body while Content-Length Header is Zero",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"pm.request.method=pm.variables.get(\"method\");"
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(pm.variables.get(\"test_prefix\") + \"Success\", function () {",
" pm.expect(pm.response.code).to.eql(200);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Length",
"value": "0",
"type": "text"
}
],
"url": {
"raw": "http://{{SERVER}}/{{endpoint}}",
"protocol": "http",
"host": [
"{{SERVER}}"
],
"path": [
"{{endpoint}}"
]
}
},
"response": []
},
{
"name": "No Body with Negative Content-Length Header",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"pm.request.method=pm.variables.get(\"method\");"
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(pm.variables.get(\"test_prefix\") + \"Bad Request\", function () {",
" pm.expect(pm.response.code).to.eql(400);",
"});",
"",
"",
"pm.test(pm.variables.get(\"test_prefix\") + \"Valid error response body\", function() {",
" pm.response.to.be.withBody;",
" pm.response.to.be.json;",
"",
" var Ajv = require('ajv');",
" ajv = new Ajv();",
" const validate = ajv.compile(JSON.parse(pm.variables.get(\"response-schema:error\")));",
"",
" const jsonData = pm.response.json();",
" pm.expect(validate(jsonData)).to.be.true;",
" pm.expect(jsonData.code).to.eql(400);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Length",
"value": "-1",
"type": "text"
}
],
"url": {
"raw": "http://{{SERVER}}/{{endpoint}}",
"protocol": "http",
"host": [
"{{SERVER}}"
],
"path": [
"{{endpoint}}"
]
}
},
"response": []
},
{
"name": "No Body with Non-numeric Content-Length Header",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"pm.request.method=pm.variables.get(\"method\");"
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(pm.variables.get(\"test_prefix\") + \"Bad Request\", function () {",
" pm.expect(pm.response.code).to.eql(400);",
"});",
"",
"",
"pm.test(pm.variables.get(\"test_prefix\") + \"Valid error response body\", function() {",
" pm.response.to.be.withBody;",
" pm.response.to.be.json;",
"",
" var Ajv = require('ajv');",
" ajv = new Ajv();",
" const validate = ajv.compile(JSON.parse(pm.variables.get(\"response-schema:error\")));",
"",
" const jsonData = pm.response.json();",
" pm.expect(validate(jsonData)).to.be.true;",
" pm.expect(jsonData.code).to.eql(400);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Length",
"value": "some text",
"type": "text"
}
],
"url": {
"raw": "http://{{SERVER}}/{{endpoint}}",
"protocol": "http",
"host": [
"{{SERVER}}"
],
"path": [
"{{endpoint}}"
]
}
},
"response": []
}
],
"event": [
......@@ -206,6 +384,14 @@
{
"key": "response-schema:error",
"value": ""
},
{
"key": "endpoint",
"value": "bg/clear"
},
{
"key": "method",
"value": "POST"
}
]
}
\ No newline at end of file
......@@ -185,6 +185,225 @@
},
"response": []
},
{
"name": "Negative Content-Length Header",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(pm.variables.get(\"test_prefix\") + \"Bad Request\", function () {",
" pm.expect(pm.response.code).to.eql(400);",
"});",
"",
"pm.test(pm.variables.get(\"test_prefix\") + \"Valid error response body\", function() {",
" pm.response.to.be.withBody;",
" pm.response.to.be.json;",
"",
" var Ajv = require('ajv');",
" ajv = new Ajv();",
" const validate = ajv.compile(JSON.parse(pm.variables.get(\"response-schema:error\")));",
"",
" const jsonData = pm.response.json();",
" pm.expect(validate(jsonData)).to.be.true;",
" pm.expect(jsonData.code).to.eql(400);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-length": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Length",
"value": "-1",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\"some\": \"content\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{SERVER}}/{{endpoint}}",
"protocol": "http",
"host": [
"{{SERVER}}"
],
"path": [
"{{endpoint}}"
]
}
},
"response": []
},
{
"name": "Content-Length Header is Zero",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(pm.variables.get(\"test_prefix\") + \"Bad Request\", function () {",
" pm.expect(pm.response.code).to.eql(400);",
"});",
"",
"pm.test(pm.variables.get(\"test_prefix\") + \"Valid error response body\", function() {",
" pm.response.to.be.withBody;",
" pm.response.to.be.json;",
"",
" var Ajv = require('ajv');",
" ajv = new Ajv();",
" const validate = ajv.compile(JSON.parse(pm.variables.get(\"response-schema:error\")));",
"",
" const jsonData = pm.response.json();",
" pm.expect(validate(jsonData)).to.be.true;",
" pm.expect(jsonData.code).to.eql(400);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-length": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Length",
"value": "0",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\"some\": \"content\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{SERVER}}/{{endpoint}}",
"protocol": "http",
"host": [
"{{SERVER}}"
],
"path": [
"{{endpoint}}"
]
}
},
"response": []
},
{
"name": "Non-numeric Content-Length Header",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(pm.variables.get(\"test_prefix\") + \"Bad Request\", function () {",
" pm.expect(pm.response.code).to.eql(400);",
"});",
"",
"pm.test(pm.variables.get(\"test_prefix\") + \"Valid error response body\", function() {",
" pm.response.to.be.withBody;",
" pm.response.to.be.json;",
"",
" var Ajv = require('ajv');",
" ajv = new Ajv();",
" const validate = ajv.compile(JSON.parse(pm.variables.get(\"response-schema:error\")));",
"",
" const jsonData = pm.response.json();",
" pm.expect(validate(jsonData)).to.be.true;",
" pm.expect(jsonData.code).to.eql(400);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-length": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Length",
"value": "some text",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\"some\": \"content\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{SERVER}}/{{endpoint}}",
"protocol": "http",
"host": [
"{{SERVER}}"
],
"path": [
"{{endpoint}}"
]
}
},
"response": []
},
{
"name": "Low Content-Length Header",
"event": [
......
Supports Markdown
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