From 617932b2a875e5a6150a2cb4a6a556380377e1f5 Mon Sep 17 00:00:00 2001 From: Matt Webster Date: Sat, 3 Apr 2021 12:40:56 -0700 Subject: [PATCH] Remove Postman tests Fixes #1071 --- server/README.md | 39 +- server/postman/README.md | 52 -- .../311-CI.postman_collection.json | 702 ------------------ .../311-all.postman_collection.json | 586 --------------- .../311-dev.postman_environment.json | 14 - .../311-local.postman_environment.json | 14 - .../311-prod.postman_environment.json | 14 - .../environments/311.postman_globals.json | 24 - server/postman/test.sh | 16 - 9 files changed, 26 insertions(+), 1435 deletions(-) delete mode 100644 server/postman/README.md delete mode 100644 server/postman/collections/311-CI.postman_collection.json delete mode 100644 server/postman/collections/311-all.postman_collection.json delete mode 100644 server/postman/environments/311-dev.postman_environment.json delete mode 100644 server/postman/environments/311-local.postman_environment.json delete mode 100644 server/postman/environments/311-prod.postman_environment.json delete mode 100644 server/postman/environments/311.postman_globals.json delete mode 100755 server/postman/test.sh diff --git a/server/README.md b/server/README.md index 8040f809d..b006e633e 100644 --- a/server/README.md +++ b/server/README.md @@ -1,20 +1,30 @@ # 311 Data Server -[![Build and Test Action Status](https://github.com/hackforla/311-data/workflows/Build%20and%20Test/badge.svg)](https://github.com/hackforla/311-data/actions) +[![API Build and Test Action Status](https://github.com/hackforla/311-data/workflows/Build%20and%20Test/badge.svg)](https://github.com/hackforla/311-data/actions) ## Server Tech Stack -The 311 Data Server is comprised of several different components deployed in containers to the cloud using Terraform. +The 311 Data Server is comprised of several different components deployed in containers to the public cloud. The API is intended to be modern, asynchronous, simple, performant, secure, open-source and well-supported. -- [FastAPI](https://fastapi.tiangolo.com/) and [Starlette](https://www.starlette.io/): tools to provide a fast, asynchronous stack for building RESTful APIs in Python -- [Gino](https://python-gino.org/) and [SQL Alchemy](https://www.sqlalchemy.org/): tools for accessing and modifying the database -- [Postgres](https://www.postgresql.org/docs/12/index.html): the persistent SQL database -- [Redis](https://redis.io/) with [Aiocache](https://aiocache.readthedocs.io/) and [Aioredis](https://aioredis.readthedocs.io/en/v1.3.0/): to provide high-performance caching -- [Prefect](https://www.prefect.io/core): for the nightly data ingestion pipeline +The server code is set up as a monorepo with directories and containers corresponding to the following functions: -Everything runs on Python 3.7 and the Debian 10 "Buster" Linux distribution where applicable. +- RESTful Python API (/api) + - [FastAPI](https://fastapi.tiangolo.com/) and [Starlette](https://www.starlette.io/): tools to provide a fast, asynchronous stack for building RESTful APIs in Python + - [Gino](https://python-gino.org/) and [SQL Alchemy](https://www.sqlalchemy.org/): tools for accessing and modifying the database + - [Postgres](https://www.postgresql.org/docs/12/index.html): the persistent SQL database + - [Redis](https://redis.io/) with [Aiocache](https://aiocache.readthedocs.io/) and [Aioredis](https://aioredis.readthedocs.io/en/v1.3.0/): to provide high-performance caching +- Report Server (/dash) + - [Plotly Dash](https://dash.plotly.com/): for interactive, responsive reports + - [Pandas](https://pandas.pydata.org/): for pulling, aggregating, and calculating data in reports +- Data loading pipeline (/prefect) + - [Prefect](https://www.prefect.io/core): for the nightly data ingestion tasks and cache clearing and priming + +The last 2 projects are: + +- [Terraform](https://www.terraform.io/): for managing the AWS infrastructure +- [Locust](https://locust.io/): for load-testing the API -The API is intended to be modern, simple, performant, secure, open-source and well-supported. The tech stack focuses on Python tools with good asynchronous support. As asynchronous libraries are still somewhat immature these dependencies may need to be updated in the future. +Everything runs on Python 3.7 and the Debian 10 "Buster" Linux distribution where applicable. ## Data Loading @@ -24,21 +34,24 @@ For more information about the data loading process look at the [Prefect README] ## Testing -Testing is done locally and as a CI process run using GitHub Actions. +Unit and integration testing is done locally and as a CI process run using GitHub Actions. There are several testing tools used in the project: - pytest: unit and integration tests -- postman: REST API integration tests - locust: load tests We currently have 90+% coverage on the API. To get code coverage reports run ```pytest --cov=code``` ## Deployment -The API is deployed to AWS using Terraform. API containers are hosted in ECS with data served from an RDS instance. +### Code Deployment + +Containers are deployed on merge to Docker Hub and new tasks are created in ECS. The result is a zero-downtime deployment. When a new version requires a database change a separate task must be created to run upgrades using Alembic. + +### Infrastructure Deployment -For more information about the deployment process look at the [Terraform README](terraform/README.md). +The infrastructure is deployed to AWS using Terraform. API containers are hosted in ECS with data served from an RDS instance. For more information about the infrastrucure deployment process look at the [Terraform README](terraform/README.md). ## More Information diff --git a/server/postman/README.md b/server/postman/README.md deleted file mode 100644 index aa2bc8fd6..000000000 --- a/server/postman/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Postman tests - -These are legacy tests developed against the initial version of the API. They run a series of tests against the old endpoints and check the HTTP status. - -## Setup - -### 1. Install and run Postman - -Download it [here](https://www.postman.com/downloads/) and start it up. - -### 2. Create a 311 workspace (optional) - -If you create a workspace, all of your 311 stuff will be grouped together, so it won't get jumbled up with anything else you're doing in Postman. - -To create one, select "create new" from dropdown menu in the middle of the nav bar (top of the window). Give it a name, select "Personal" type (instead of "Team"), and hit "Create Workspace". - -### 3. Import this folder - -Click the Import button at the top left, select "Folder" from the tabs, and then select this folder (`/server/postman`) from the finder. The import will add two collections to Postman: - -- **311-all**: a collection containing all of the endpoints that the api currently supports, with pre-populated params for each api call. -- **311-CI**: a collection containing all of the tests we run during continuous integration. These include tests for bad input -- e.g., a missing required param should return 400, an unsupported endpoint should return a 404. - -The import will also add three environments: - -- **311-local**: all api calls go to your local server (which should be running) -- **311-dev**: api calls go to the dev server -- **311-prod**: api calls go to the production server - -### 4. Activate the `311-local` environment. - -Just select it from the dropdown at the top right of the window. - -## Usage - -### Run a single api call - -Open the `311-all` collection on the left, and click one of the endpoints. Then click the blue "Send" button next to the url bar. This will send a request to the endpoint and show you the result. If you click around underneath the url bar, you'll find the body of the request (if it's a POST), and in the section below that, the body of the response. - -### Run an entire collection - -Click "Runner" at the top left to open the collection runner. Then select one of the two collections, select the `311-local` environment, and hit the blue button. Postman will make an api call to your local server for each item in the collection, and print a summary of the results. - -Note that the `311-CI` collection contains all of the tests we run whenever you submit a pull request to `dev`. So if you want to help make sure your PR gets approved, run these tests before submitting. - -### Run CI tests from the command line - -As an alternative to running the CI tests in Postman, you can run them from the command line. Run this command from the `/server` directory: - -```bash -chmod +x postman/test.sh && postman/test.sh -``` diff --git a/server/postman/collections/311-CI.postman_collection.json b/server/postman/collections/311-CI.postman_collection.json deleted file mode 100644 index 55998abb4..000000000 --- a/server/postman/collections/311-CI.postman_collection.json +++ /dev/null @@ -1,702 +0,0 @@ -{ - "info": { - "_postman_id": "086080e5-c63f-4313-8818-651d0a8bedeb", - "name": "311-CI", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "/", - "event": [ - { - "listen": "test", - "script": { - "id": "3d4ca159-53fa-4ebd-a748-7b34314b484d", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}", - "host": [ - "{{base_url}}" - ] - } - }, - "response": [] - }, - { - "name": "/status/api", - "event": [ - { - "listen": "test", - "script": { - "id": "7a73f45a-6eec-4204-9b7c-3607859381e2", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/status/api", - "host": [ - "{{base_url}}" - ], - "path": [ - "status", - "api" - ] - } - }, - "response": [] - }, - { - "name": "/servicerequest", - "event": [ - { - "listen": "test", - "script": { - "id": "0ffe8438-1ba1-4d7d-9f00-ecec86286dc4", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/servicerequest/1-1523590121", - "host": [ - "{{base_url}}" - ], - "path": [ - "servicerequest", - "1-1523590121" - ] - } - }, - "response": [] - }, - { - "name": "/map/heat", - "event": [ - { - "listen": "test", - "script": { - "id": "56817d4c-d21f-4b88-8284-fd5cfeb0f727", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-05-01\",\n\t\"endDate\": \"2020-06-02\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\", \"Dead Animal Removal\"],\n\t\"ncList\": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/map/heat", - "host": [ - "{{base_url}}" - ], - "path": [ - "map", - "heat" - ] - } - }, - "response": [] - }, - { - "name": "/map/pins", - "event": [ - { - "listen": "test", - "script": { - "id": "6963cb24-0804-42ee-96a9-203a65c4aee5", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-05-01\",\n\t\"endDate\": \"2020-06-02\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\", \"Dead Animal Removal\"],\n\t\"ncList\": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/map/pins", - "host": [ - "{{base_url}}" - ], - "path": [ - "map", - "pins" - ] - } - }, - "response": [] - }, - { - "name": "/visualizations", - "event": [ - { - "listen": "test", - "script": { - "id": "ced42e4a-38f6-4a3e-b675-3b57903ac27a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-02-01\",\n\t\"endDate\": \"2020-05-15\",\n\t\"requestTypes\": {{all_request_types}},\n\t\"ncList\": [4, 5, 6]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/visualizations", - "host": [ - "{{base_url}}" - ], - "path": [ - "visualizations" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/frequency", - "event": [ - { - "listen": "test", - "script": { - "id": "e747ba5c-ade7-4d92-9091-af25a8cd3533", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-01-24\",\n\t\"endDate\": \"2020-05-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"nc\",\n\t\t\"list\": [4, 8, 10, 11, 12, 13, 14, 15, 16]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": [7, 8, 9, 10]\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/frequency", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "frequency" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/timetoclose", - "event": [ - { - "listen": "test", - "script": { - "id": "d2e5c7f3-23e7-4406-953d-6bfaee5ac538", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-01-24\",\n\t\"endDate\": \"2020-05-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"nc\",\n\t\t\"list\": [4, 6, 7, 10, 15, 20, 30]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": [7, 10, 15, 20, 30]\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/timetoclose", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "timetoclose" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/counts", - "event": [ - { - "listen": "test", - "script": { - "id": "4f35b717-52c3-4e13-b896-95ad35b1da93", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " if (pm.response.code === 500) {", - " console.log(pm.response.text())", - " }", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2019-01-24\",\n\t\"endDate\": \"2020-03-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"nc\",\n\t\t\"list\": [4]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": [7]\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/counts", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "counts" - ] - } - }, - "response": [] - }, - { - "name": "/invalid-endpoint", - "event": [ - { - "listen": "test", - "script": { - "id": "27f722cc-4d1c-46c0-b908-448c3825623d", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/invalid-endpoint", - "host": [ - "{{base_url}}" - ], - "path": [ - "invalid-endpoint" - ] - } - }, - "response": [] - }, - { - "name": "/status/api -- invalid method", - "event": [ - { - "listen": "test", - "script": { - "id": "1284655d-dbf4-47be-bead-9691faa9e9e3", - "exec": [ - "pm.test(\"Status code is 405\", function () {", - " pm.response.to.have.status(405);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/status/api", - "host": [ - "{{base_url}}" - ], - "path": [ - "status", - "api" - ] - } - }, - "response": [] - }, - { - "name": "/visualizations -- missing startDate", - "event": [ - { - "listen": "test", - "script": { - "id": "7b817388-1582-4ae6-a528-55cd117e6e85", - "exec": [ - "pm.test(\"Status code is 400 or 422\", function () {", - " pm.expect(pm.response.code).to.be.oneOf([400, 422]);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"endDate\": \"06/20/20\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"ncList\": [4, 5, 6]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/visualizations", - "host": [ - "{{base_url}}" - ], - "path": [ - "visualizations" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/frequency -- invalid cc", - "event": [ - { - "listen": "test", - "script": { - "id": "b9124b20-d2fc-4207-bf57-43be22772f69", - "exec": [ - "pm.test(\"Status code is 400 or 422\", function () {", - " pm.expect(pm.response.code).to.be.oneOf([400, 422]);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-01-24\",\n\t\"endDate\": \"2020-05-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"nc\",\n\t\t\"list\": [4, 8, 10, 11, 12, 13, 14, 15, 16]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": [7, 8, 9, 10, \"District 1\"]\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/frequency", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "frequency" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/counts -- invalid district", - "event": [ - { - "listen": "test", - "script": { - "id": "4bfd4f4b-3f04-4208-909b-273fec1fff04", - "exec": [ - "pm.test(\"Status code is 400 or 422\", function () {", - " pm.expect(pm.response.code).to.be.oneOf([400, 422]);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2019-01-24\",\n\t\"endDate\": \"2020-03-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"dd\",\n\t\t\"list\": [4]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": [7]\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/counts", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "counts" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "02a8fc97-0af5-480f-b8c4-5cb5cdde5911", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "3e303a6b-f3ec-4a96-8b10-d547c8194109", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {} -} \ No newline at end of file diff --git a/server/postman/collections/311-all.postman_collection.json b/server/postman/collections/311-all.postman_collection.json deleted file mode 100644 index 6480010f3..000000000 --- a/server/postman/collections/311-all.postman_collection.json +++ /dev/null @@ -1,586 +0,0 @@ -{ - "info": { - "_postman_id": "3775ad8c-32d6-4087-878c-b3cc54080f30", - "name": "311-all", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "/", - "event": [ - { - "listen": "test", - "script": { - "id": "15354c67-8247-40eb-b239-1fc38f70c05d", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}", - "host": [ - "{{base_url}}" - ] - } - }, - "response": [] - }, - { - "name": "/status/api", - "event": [ - { - "listen": "test", - "script": { - "id": "abb8640b-9319-45b7-a7cb-aef5a6afe25e", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/status/api", - "host": [ - "{{base_url}}" - ], - "path": [ - "status", - "api" - ] - } - }, - "response": [] - }, - { - "name": "/status/sys", - "event": [ - { - "listen": "test", - "script": { - "id": "54642304-8e34-4f4a-96bf-17fc3ad1ba01", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/status/sys", - "host": [ - "{{base_url}}" - ], - "path": [ - "status", - "sys" - ] - } - }, - "response": [] - }, - { - "name": "/status/db", - "event": [ - { - "listen": "test", - "script": { - "id": "108ca2c8-ff27-48a8-b2e0-0ec9c56dd1a3", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/status/db", - "host": [ - "{{base_url}}" - ], - "path": [ - "status", - "db" - ] - } - }, - "response": [] - }, - { - "name": "/servicerequest", - "event": [ - { - "listen": "test", - "script": { - "id": "66aa522f-8106-41e9-b2fc-31957e537d8a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/servicerequest/1-1523590121", - "host": [ - "{{base_url}}" - ], - "path": [ - "servicerequest", - "1-1523590121" - ] - } - }, - "response": [] - }, - { - "name": "/map/heat", - "event": [ - { - "listen": "test", - "script": { - "id": "250ee11d-f610-4289-8fd8-e4d512f6aec1", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-05-01\",\n\t\"endDate\": \"2020-06-02\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\", \"Dead Animal Removal\"],\n\t\"ncList\": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/map/heat", - "host": [ - "{{base_url}}" - ], - "path": [ - "map", - "heat" - ] - } - }, - "response": [] - }, - { - "name": "/map/pins", - "event": [ - { - "listen": "test", - "script": { - "id": "e8dbb51a-2511-4598-9676-d275e13847b5", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-05-01\",\n\t\"endDate\": \"2020-06-02\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\", \"Dead Animal Removal\"],\n\t\"ncList\": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/map/pins", - "host": [ - "{{base_url}}" - ], - "path": [ - "map", - "pins" - ] - } - }, - "response": [] - }, - { - "name": "/visualizations", - "event": [ - { - "listen": "test", - "script": { - "id": "a583491c-1659-4195-9619-a5bb2e515383", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-03-01\",\n\t\"endDate\": \"2020-07-01\",\n\t\"requestTypes\": {{all_request_types}},\n\t\"ncList\": [4, 5, 6]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/visualizations", - "host": [ - "{{base_url}}" - ], - "path": [ - "visualizations" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/frequency", - "event": [ - { - "listen": "test", - "script": { - "id": "65727d5d-ed4e-4029-a84b-77f270362e88", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-01-24\",\n\t\"endDate\": \"2020-05-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"nc\",\n\t\t\"list\": [4, 8, 10, 11, 12, 13, 14, 15, 16]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": [7, 8, 9, 10]\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/frequency", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "frequency" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/timetoclose", - "event": [ - { - "listen": "test", - "script": { - "id": "d7f23224-03c0-4ad8-9ece-a1eac6b7fc5c", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2020-01-24\",\n\t\"endDate\": \"2020-05-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"nc\",\n\t\t\"list\": [4, 6, 7, 10, 15, 20, 30]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": [7, 10, 15, 20, 30]\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/timetoclose", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "timetoclose" - ] - } - }, - "response": [] - }, - { - "name": "/comparison/counts", - "event": [ - { - "listen": "test", - "script": { - "id": "36f83774-a6f7-4c04-b60d-7fdfee92480a", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"startDate\": \"2019-01-24\",\n\t\"endDate\": \"2020-03-24\",\n\t\"requestTypes\": [\"Bulky Items\", \"Graffiti Removal\"],\n\t\"set1\": {\n\t\t\"district\": \"nc\",\n\t\t\"list\": [4]\n\t},\n\t\"set2\": {\n\t\t\"district\": \"cc\",\n\t\t\"list\": {{all_ccs}}\n\t}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{base_url}}/comparison/counts", - "host": [ - "{{base_url}}" - ], - "path": [ - "comparison", - "counts" - ] - } - }, - "response": [] - }, - { - "name": "/open-requests", - "event": [ - { - "listen": "test", - "script": { - "id": "9cf4f68a-2c22-42e0-b8af-1e0f16f7527c", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "url": { - "raw": "{{base_url}}/open-requests", - "host": [ - "{{base_url}}" - ], - "path": [ - "open-requests" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "88593294-1bc3-4fdc-97a0-faf9b049e71f", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "c9cf2c94-ccc5-43ea-b12c-f2a28707f771", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "protocolProfileBehavior": {} -} \ No newline at end of file diff --git a/server/postman/environments/311-dev.postman_environment.json b/server/postman/environments/311-dev.postman_environment.json deleted file mode 100644 index 8186719ff..000000000 --- a/server/postman/environments/311-dev.postman_environment.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "f04f9391-9e86-4200-a14f-aa6e63cc7a35", - "name": "311-dev", - "values": [ - { - "key": "base_url", - "value": "http://dev-api.311-data.org", - "enabled": true - } - ], - "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-06-27T14:04:02.720Z", - "_postman_exported_using": "Postman/7.26.1" -} \ No newline at end of file diff --git a/server/postman/environments/311-local.postman_environment.json b/server/postman/environments/311-local.postman_environment.json deleted file mode 100644 index 9bd6f02b0..000000000 --- a/server/postman/environments/311-local.postman_environment.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "e2a8dfb0-eea4-4391-a042-a7ae4df38061", - "name": "311-local", - "values": [ - { - "key": "base_url", - "value": "http://localhost:5000", - "enabled": true - } - ], - "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-06-26T21:24:30.145Z", - "_postman_exported_using": "Postman/7.26.1" -} \ No newline at end of file diff --git a/server/postman/environments/311-prod.postman_environment.json b/server/postman/environments/311-prod.postman_environment.json deleted file mode 100644 index 2ff231d1a..000000000 --- a/server/postman/environments/311-prod.postman_environment.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "ba306f87-9ede-45b0-910b-80dff9b05ed3", - "name": "311-prod", - "values": [ - { - "key": "base_url", - "value": "https://api.311-data.org", - "enabled": true - } - ], - "_postman_variable_scope": "environment", - "_postman_exported_at": "2020-06-26T21:24:06.892Z", - "_postman_exported_using": "Postman/7.26.1" -} \ No newline at end of file diff --git a/server/postman/environments/311.postman_globals.json b/server/postman/environments/311.postman_globals.json deleted file mode 100644 index 33293df5e..000000000 --- a/server/postman/environments/311.postman_globals.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "id": "77679312-e8fd-40aa-81cd-3eb5ff5332f7", - "values": [ - { - "key": "all_request_types", - "value": "[\"Bulky Items\",\"Graffiti Removal\",\"Homeless Encampment\",\"Illegal Dumping Pickup\",\"Dead Animal Removal\",\"Electronic Waste\",\"Single Streetlight Issue\",\"Multiple Streetlight Issue\",\"Metal/Household Appliances\",\"Feedback\",\"Other\"]", - "enabled": true - }, - { - "key": "all_ncs", - "value": "[4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 50, 52, 53, 54, 55, 58, 60, 61, 62, 63, 64, 66, 67, 68, 70, 71, 73, 74, 75, 76, 77, 78, 79, 80, 81, 84, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 104, 109, 110, 111, 112, 113, 114, 115, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128]", - "enabled": true - }, - { - "key": "all_ccs", - "value": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]", - "enabled": true - } - ], - "name": "311 Globals", - "_postman_variable_scope": "globals", - "_postman_exported_at": "2020-06-12T13:14:34.886Z", - "_postman_exported_using": "Postman/7.25.3" -} \ No newline at end of file diff --git a/server/postman/test.sh b/server/postman/test.sh deleted file mode 100755 index eaa067017..000000000 --- a/server/postman/test.sh +++ /dev/null @@ -1,16 +0,0 @@ -# this hits all the endpoints in the CI collection using the local env - -# to use, run this script from the /server directory while the api is running -# chmod +x postman/test.sh && postman/test.sh - - -COLLECTION=311-CI -ENVIRONMENT=311-local - -docker run \ - --network host \ - -v `pwd`/postman/collections:/etc/newman \ - -v `pwd`/postman/environments:/etc/newman-envs \ - -t postman/newman:alpine run ${COLLECTION}.postman_collection.json \ - --environment /etc/newman-envs/${ENVIRONMENT}.postman_environment.json \ - --globals /etc/newman-envs/311.postman_globals.json