From 5ee8bbc26d43135022ebd82bf423ba4141f0bf9d Mon Sep 17 00:00:00 2001 From: edunn Date: Wed, 7 Aug 2024 16:36:08 -0700 Subject: [PATCH] implement tests for registry-api #494 --- docker/postman/postman_collection.json | 324 +++++++++++++++++++++++++ 1 file changed, 324 insertions(+) diff --git a/docker/postman/postman_collection.json b/docker/postman/postman_collection.json index eee9b81..23456a7 100644 --- a/docker/postman/postman_collection.json +++ b/docker/postman/postman_collection.json @@ -476,6 +476,330 @@ { "name": "requirements", "item": [ + { + "name": "NASA-PDS/registry-api#494 querystring supports EQ", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const testrailId = \"C4440539\";", + "const minimumExpectedHits = 2; // actual count may increase as data is added to test corpus", + "function testHitConstraints(hit) {", + " pm.expect(hit.properties.product_class[0]).to.eq(\"Product_Bundle\")", + "};", + "", + "pm.test(`${testrailId} Status code is 200`, () => {", + " pm.response.to.have.status(200);", + "});", + "", + "var data = pm.response.json().data;", + "", + "pm.test(`${testrailId} Number of results is at least ${minimumExpectedHits}`, () => {", + " pm.expect(data.length).gte(minimumExpectedHits); ", + "});", + "", + "pm.test(`${testrailId} Returned hits satisfy constraints`, () => {", + " data.forEach(testHitConstraints) ", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products?q=(product_class EQ \"Product_Bundle\")", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ], + "query": [ + { + "key": "q", + "value": "(product_class EQ \"Product_Bundle\")" + } + ] + } + }, + "response": [] + }, + { + "name": "NASA-PDS/registry-api#494 querystring supports NE", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const testrailId = \"C4440540\";", + "const minimumExpectedHits = 36; // actual count may increase as data is added to test corpus", + "function testHitConstraints(hit) {", + " pm.expect(hit.properties.product_class[0]).to.not.eq(\"Product_Bundle\")", + "};", + "", + "pm.test(`${testrailId} Status code is 200`, () => {", + " pm.response.to.have.status(200);", + "});", + "", + "var data = pm.response.json().data;", + "", + "pm.test(`${testrailId} Number of results is at least ${minimumExpectedHits}`, () => {", + " pm.expect(data.length).gte(minimumExpectedHits); ", + "});", + "", + "pm.test(`${testrailId} Returned hits satisfy constraints`, () => {", + " data.forEach(testHitConstraints) ", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products?q=(product_class NE \"Product_Bundle\")", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ], + "query": [ + { + "key": "q", + "value": "(product_class NE \"Product_Bundle\")" + } + ] + } + }, + "response": [] + }, + { + "name": "NASA-PDS/registry-api#494 querystring supports GT", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const testrailId = \"C4440541\";", + "const minimumExpectedHits = 6; // actual count may increase as data is added to test corpus", + "function testHitConstraints(hit) {", + " pm.expect(Date.parse(hit.properties[\"pds:Time_Coordinates.pds:start_date_time\"][0])).gt(Date.parse(\"2020-07-30T12:51:34Z\"))", + "};", + "", + "pm.test(`${testrailId} Status code is 200`, () => {", + " pm.response.to.have.status(200);", + "});", + "", + "var data = pm.response.json().data;", + "", + "pm.test(`${testrailId} Number of results is at least ${minimumExpectedHits}`, () => {", + " pm.expect(data.length).gte(minimumExpectedHits); ", + "});", + "", + "pm.test(`${testrailId} Returned hits satisfy constraints`, () => {", + " data.forEach(testHitConstraints) ", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products?q=(pds:Time_Coordinates.pds:start_date_time GT \"2020-07-30T12:51:34Z\")", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ], + "query": [ + { + "key": "q", + "value": "(pds:Time_Coordinates.pds:start_date_time GT \"2020-07-30T12:51:34Z\")" + } + ] + } + }, + "response": [] + }, + { + "name": "NASA-PDS/registry-api#494 querystring supports LT", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const testrailId = \"C4440542\";", + "const minimumExpectedHits = 25; // actual count may increase as data is added to test corpus", + "function testHitConstraints(hit) {", + " pm.expect(Date.parse(hit.properties[\"pds:Time_Coordinates.pds:start_date_time\"][0])).lt(Date.parse(\"2020-07-30T12:51:34Z\"))", + "};", + "", + "pm.test(`${testrailId} Status code is 200`, () => {", + " pm.response.to.have.status(200);", + "});", + "", + "var data = pm.response.json().data;", + "", + "pm.test(`${testrailId} Number of results is at least ${minimumExpectedHits}`, () => {", + " pm.expect(data.length).gte(minimumExpectedHits); ", + "});", + "", + "pm.test(`${testrailId} Returned hits satisfy constraints`, () => {", + " data.forEach(testHitConstraints) ", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products?q=(pds:Time_Coordinates.pds:start_date_time LT \"2020-07-30T12:51:34Z\")", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ], + "query": [ + { + "key": "q", + "value": "(pds:Time_Coordinates.pds:start_date_time LT \"2020-07-30T12:51:34Z\")" + } + ] + } + }, + "response": [] + }, + { + "name": "NASA-PDS/registry-api#494 querystring supports GE", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const testrailId = \"C4440543\";", + "const minimumExpectedHits = 13; // actual count may increase as data is added to test corpus", + "function testHitConstraints(hit) {", + " pm.expect(Date.parse(hit.properties[\"pds:Time_Coordinates.pds:start_date_time\"][0])).gte(Date.parse(\"2020-07-30T12:51:34Z\"))", + "};", + "", + "pm.test(`${testrailId} Status code is 200`, () => {", + " pm.response.to.have.status(200);", + "});", + "", + "var data = pm.response.json().data;", + "", + "pm.test(`${testrailId} Number of results is at least ${minimumExpectedHits}`, () => {", + " pm.expect(data.length).gte(minimumExpectedHits); ", + "});", + "", + "pm.test(`${testrailId} Returned hits satisfy constraints`, () => {", + " data.forEach(testHitConstraints) ", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products?q=(pds:Time_Coordinates.pds:start_date_time GE \"2020-07-30T12:51:34Z\")", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ], + "query": [ + { + "key": "q", + "value": "(pds:Time_Coordinates.pds:start_date_time GE \"2020-07-30T12:51:34Z\")" + } + ] + } + }, + "response": [] + }, + { + "name": "NASA-PDS/registry-api#494 querystring supports LE", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const testrailId = \"C4440544\";", + "const minimumExpectedHits = 32; // actual count may increase as data is added to test corpus", + "function testHitConstraints(hit) {", + " pm.expect(Date.parse(hit.properties[\"pds:Time_Coordinates.pds:start_date_time\"][0])).lte(Date.parse(\"2020-07-30T12:51:34Z\"))", + "};", + "", + "pm.test(`${testrailId} Status code is 200`, () => {", + " pm.response.to.have.status(200);", + "});", + "", + "var data = pm.response.json().data;", + "", + "pm.test(`${testrailId} Number of results is at least ${minimumExpectedHits}`, () => {", + " pm.expect(data.length).gte(minimumExpectedHits); ", + "});", + "", + "pm.test(`${testrailId} Returned hits satisfy constraints`, () => {", + " data.forEach(testHitConstraints) ", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products?q=(pds:Time_Coordinates.pds:start_date_time LE \"2020-07-30T12:51:34Z\")", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ], + "query": [ + { + "key": "q", + "value": "(pds:Time_Coordinates.pds:start_date_time LE \"2020-07-30T12:51:34Z\")" + } + ] + } + }, + "response": [] + }, { "name": "NASA-PDS/registry-api#495 querystring supports AND", "event": [