1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

test: add api tests for query auth

This commit is contained in:
Ferdinand Mütsch 2021-10-11 11:29:38 +02:00
parent 52744dbcd0
commit a94092e31c
3 changed files with 612 additions and 508 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "36595622-81dc-4f4a-826e-345ae63fc83b",
"_postman_id": "da93a75e-e931-4f00-80b8-428f0e7ae824",
"name": "Wakapi API Tests",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
@ -251,6 +251,105 @@
}
},
"response": []
},
{
"name": "Authenticate (header)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableCookies": true,
"followRedirects": false
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{WRITEUSER_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{BASE_URL}}/api/summary?interval=today",
"host": [
"{{BASE_URL}}"
],
"path": [
"api",
"summary"
],
"query": [
{
"key": "interval",
"value": "today"
}
]
}
},
"response": []
},
{
"name": "Authenticate (query param)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableCookies": true,
"followRedirects": false
},
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"url": {
"raw": "{{BASE_URL}}/api/summary?interval=today&api_key={{WRITEUSER_API_KEY}}",
"host": [
"{{BASE_URL}}"
],
"path": [
"api",
"summary"
],
"query": [
{
"key": "interval",
"value": "today"
},
{
"key": "api_key",
"value": "{{WRITEUSER_API_KEY}}"
}
]
}
},
"response": []
}
]
},

View File

@ -1,9 +1,7 @@
#!/bin/bash
if [ ! -f "wakapi" ]; then
echo "Wakapi executable not found. Compiling."
go build
fi
echo "Compiling."
go build
if ! command -v newman &> /dev/null
then