mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
3457 lines
82 KiB
JSON
3457 lines
82 KiB
JSON
{
|
|
"info": {
|
|
"_postman_id": "43639725-0458-40d7-a4d4-9f55a539a7f7",
|
|
"name": "Wakapi API Tests",
|
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
},
|
|
"item": [
|
|
{
|
|
"name": "Auth",
|
|
"item": [
|
|
{
|
|
"name": "Sign up user",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body matches string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"Account created successfully\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "location",
|
|
"value": "{{TZ}}",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "username",
|
|
"value": "testuser",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "email",
|
|
"value": "testuser@wakapi.dev",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password",
|
|
"value": "testpassword",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password_repeat",
|
|
"value": "testpassword",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/signup",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"signup"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Sign up existing user (conflict)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 409\", function () {",
|
|
" pm.response.to.have.status(409);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body matches string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"User already existing\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "location",
|
|
"value": "{{TZ}}",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "username",
|
|
"value": "testuser",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "email",
|
|
"value": "testuser@wakapi.dev",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password",
|
|
"value": "testpassword",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password_repeat",
|
|
"value": "testpassword",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/signup",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"signup"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Login",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 302\", function () {",
|
|
" pm.response.to.have.status(302);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Redirect to summary\", function () {",
|
|
" pm.expect(pm.response.headers.get(\"Location\")).to.eql(\"/summary\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Sets cookie\", function () {",
|
|
" pm.expect(pm.response.headers.get(\"Set-Cookie\")).to.include(\"wakapi_auth=\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true,
|
|
"followRedirects": false
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "username",
|
|
"value": "testuser",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password",
|
|
"value": "testpassword",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/login",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"login"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Login (wrong password)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"No redirect\", function () {",
|
|
" pm.response.to.not.have.header(\"Location\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true,
|
|
"followRedirects": false
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "username",
|
|
"value": "testuser",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password",
|
|
"value": "wrongpassword",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/login",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"login"
|
|
]
|
|
}
|
|
},
|
|
"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": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Heartbeats",
|
|
"item": [
|
|
{
|
|
"name": "Create heartbeats",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[1].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
" pm.expect(jsonData.responses[1][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts3}}\n}]",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/heartbeat",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"heartbeat"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (alt 1)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[1].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
" pm.expect(jsonData.responses[1][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts2}}\n}]",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/v1/users/current/heartbeats.bulk",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"heartbeats.bulk"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (alt 2)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[1].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
" pm.expect(jsonData.responses[1][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts2}}\n}]",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/heartbeats",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"heartbeats"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (alt 3)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[1].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
" pm.expect(jsonData.responses[1][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts2}}\n}]",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/users/current/heartbeats.bulk",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"users",
|
|
"current",
|
|
"heartbeats.bulk"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (alt 4, single)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(1);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/heartbeat",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"heartbeat"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (alt 5, single)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(1);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/v1/users/current/heartbeats",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"heartbeats"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (alt 6, single)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(1);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/heartbeats",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"heartbeats"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (alt 7, single)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 201\", function () {",
|
|
" pm.response.to.have.status(201);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.responses.length).to.eql(1);",
|
|
" pm.expect(jsonData.responses[0].length).to.eql(2);",
|
|
" pm.expect(jsonData.responses[0][1]).to.eql(201);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/users/current/heartbeats",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"users",
|
|
"current",
|
|
"heartbeats"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (non-matching)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 404\", function () {",
|
|
" pm.response.to.have.status(404);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/v2/users/current/heartbeats",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v2",
|
|
"users",
|
|
"current",
|
|
"heartbeats"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (unauthorized)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "[{\n \"entity\": \"/home/user1/dev/proejct1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{tsNowMinus1Min}}\n}]",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/heartbeat",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"heartbeat"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create heartbeats (get heartbeats test)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"// 1640995199 Friday, 31 December 2021 11:59:59 PM (Jan 1st in +1, +2)",
|
|
"// 1641074399 Saturday, 1 January 2022 9:59:59 PM (Jan 1st in +1, +2)",
|
|
"// 1641081599 Saturday, 1 January 2022 11:59:59 PM (Jan 2nd in +1, +2)",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": 1640995199\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": 1641074399\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": 1641081599\n}]",
|
|
"options": {
|
|
"raw": {
|
|
"language": "json"
|
|
}
|
|
}
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/heartbeat",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"heartbeat"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get heartbeats",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Response body is correct\", function () {",
|
|
" var jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.timezone).to.eql(pm.collectionVariables.get('TZ'));",
|
|
" var date = new Date(\"2022-01-01T00:00:00+0100\")",
|
|
" pm.expect(new Date(jsonData.start)).to.eql(date);",
|
|
" pm.expect(new Date(jsonData.end)).to.eql(new Date(date.getTime() + 3600 * 1000 * 24 - 1000));",
|
|
" pm.expect(jsonData.data.length).to.eql(2);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/heartbeats?date=2022-01-01",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"heartbeats"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "date",
|
|
"value": "2022-01-01"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Summary",
|
|
"item": [
|
|
{
|
|
"name": "Get summary (today)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct user\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct summary data\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.projects.length).to.eql(1);",
|
|
" pm.expect(jsonData.languages.length).to.eql(1);",
|
|
" pm.expect(jsonData.editors.length).to.eql(1);",
|
|
" pm.expect(jsonData.operating_systems.length).to.eql(1);",
|
|
" pm.expect(jsonData.machines.length).to.eql(1);",
|
|
" pm.expect(jsonData.branches).to.be.null;",
|
|
"});",
|
|
"",
|
|
"/*",
|
|
"// This is something the unit tests are supposed to check",
|
|
"pm.test(\"Correct summary range\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" const from = moment(jsonData.from)",
|
|
" const to = moment(jsonData.to)",
|
|
"",
|
|
" pm.expect(moment.duration(moment().diff(from.add(2, 'm'))).asSeconds()).to.lt(10); // first heartbeat is now minus 1 min minus some latency",
|
|
" pm.expect(moment.duration(moment().diff(to.add(1, 'm'))).asSeconds()).to.lt(10); // first heartbeat is now minus 1 min minus some latency",
|
|
"});",
|
|
"*/"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"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": "Get summary (last 7 days)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct user\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct summary data\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.projects.length).to.eql(1);",
|
|
" pm.expect(jsonData.languages.length).to.eql(1);",
|
|
" pm.expect(jsonData.editors.length).to.eql(1);",
|
|
" pm.expect(jsonData.operating_systems.length).to.eql(1);",
|
|
" pm.expect(jsonData.machines.length).to.eql(1);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?interval=last_7_days",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "interval",
|
|
"value": "last_7_days"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get summary (week)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct user\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct summary data\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.projects.length).to.eql(1);",
|
|
" pm.expect(jsonData.languages.length).to.eql(1);",
|
|
" pm.expect(jsonData.editors.length).to.eql(1);",
|
|
" pm.expect(jsonData.operating_systems.length).to.eql(1);",
|
|
" pm.expect(jsonData.machines.length).to.eql(1);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?start=week",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "start",
|
|
"value": "week"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get summary (range)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct user\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct summary data\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.projects.length).to.eql(1);",
|
|
" pm.expect(jsonData.languages.length).to.eql(1);",
|
|
" pm.expect(jsonData.editors.length).to.eql(1);",
|
|
" pm.expect(jsonData.operating_systems.length).to.eql(1);",
|
|
" pm.expect(jsonData.machines.length).to.eql(1);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct dates\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(moment(jsonData.from).unix()).to.gte(moment(pm.variables.get('tsStartOfDayDate')).unix())",
|
|
" pm.expect(moment(jsonData.to).unix()).to.gte(moment(pm.variables.get('tsEndOfDayDate')).unix())",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?from={{tsStartOfDayDate}}&to={{tsEndOfTomorrowDate}}",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "from",
|
|
"value": "{{tsStartOfDayDate}}"
|
|
},
|
|
{
|
|
"key": "to",
|
|
"value": "{{tsEndOfTomorrowDate}}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get summary (default tz)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct time zone\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" const targetDateTz = moment(`2021-05-28T00:00:00${pm.variables.get('TZ_OFFSET')}`)",
|
|
" pm.expect(moment(jsonData.from).isSame(targetDateTz)).to.eql(true)",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true,
|
|
"disableUrlEncoding": false
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?from=2021-05-28&to=2021-05-28",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "from",
|
|
"value": "2021-05-28"
|
|
},
|
|
{
|
|
"key": "to",
|
|
"value": "2021-05-28"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get summary (parse tz)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct time zone\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" // when it was midnight in UTC+3, it was still 11 pm in Germany",
|
|
" const targetDateTz = moment(`2021-05-28T00:00:00${pm.variables.get('TZ_OFFSET')}`).add(-1, 'h')",
|
|
" pm.expect(moment(jsonData.from).isSame(targetDateTz)).to.eql(true)",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?from=2021-05-28T00:00:00%2B03:00&to=2021-05-28T00:00:00%2B03:00",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "from",
|
|
"value": "2021-05-28T00:00:00%2B03:00"
|
|
},
|
|
{
|
|
"key": "to",
|
|
"value": "2021-05-28T00:00:00%2B03:00"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get summary (unauthenticated)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?interval=today",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "interval",
|
|
"value": "today"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get summary (today, filtered)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct user\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct summary data\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.projects.length).to.eql(1);",
|
|
" pm.expect(jsonData.languages.length).to.eql(1);",
|
|
" pm.expect(jsonData.editors.length).to.eql(1);",
|
|
" pm.expect(jsonData.operating_systems.length).to.eql(1);",
|
|
" pm.expect(jsonData.machines.length).to.eql(1);",
|
|
" pm.expect(jsonData.branches.length).to.eql(1);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?interval=today&project=wakapi&language=Go",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "interval",
|
|
"value": "today"
|
|
},
|
|
{
|
|
"key": "project",
|
|
"value": "wakapi"
|
|
},
|
|
{
|
|
"key": "language",
|
|
"value": "Go"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get summary (today, filtered non-matching)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct user\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct summary data\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.projects.length).to.eql(0);",
|
|
" pm.expect(jsonData.languages.length).to.eql(0);",
|
|
" pm.expect(jsonData.editors.length).to.eql(0);",
|
|
" pm.expect(jsonData.operating_systems.length).to.eql(0);",
|
|
" pm.expect(jsonData.machines.length).to.eql(0);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/summary?interval=today&project=wakapi&language=JavaScript",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"summary"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "interval",
|
|
"value": "today"
|
|
},
|
|
{
|
|
"key": "project",
|
|
"value": "wakapi"
|
|
},
|
|
{
|
|
"key": "language",
|
|
"value": "JavaScript"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Metrics",
|
|
"item": [
|
|
{
|
|
"name": "Get admin metrics",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct Content-Type\", function () {",
|
|
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.eql(\"text/plain; charset=utf-8\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body matches string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"wakatime_heartbeats_total\");",
|
|
" pm.expect(pm.response.text()).to.include(\"wakatime_admin_heartbeats_total\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{READUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/metrics",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"metrics"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get user metrics",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct Content-Type\", function () {",
|
|
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.eql(\"text/plain; charset=utf-8\");",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body matches string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"wakatime_heartbeats_total\");",
|
|
" pm.expect(pm.response.text()).to.not.include(\"wakatime_admin_heartbeats_total\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/metrics",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"metrics"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get metrics (unauthorized)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/metrics",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"metrics"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Shields",
|
|
"item": [
|
|
{
|
|
"name": "Get shields",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.message).to.eql('0 hrs 2 mins');",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:last_7_days/project:wakapi",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"shields",
|
|
"v1",
|
|
"writeuser",
|
|
"interval:last_7_days",
|
|
"project:wakapi"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get shields (filter)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.message).to.eql('0 hrs 0 mins');",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:last_7_days/project:nonexisting",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"shields",
|
|
"v1",
|
|
"writeuser",
|
|
"interval:last_7_days",
|
|
"project:nonexisting"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get shields (invalid range)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 403\", function () {",
|
|
" pm.response.to.have.status(403);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:last_30_days",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"shields",
|
|
"v1",
|
|
"writeuser",
|
|
"interval:last_30_days"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get shields (not sharing)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 403\", function () {",
|
|
" pm.response.to.have.status(403);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/shields/v1/readuser/interval:today",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"shields",
|
|
"v1",
|
|
"readuser",
|
|
"interval:today"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get shields (non-shared entity type)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 403\", function () {",
|
|
" pm.response.to.have.status(403);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:today/language:Go",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"shields",
|
|
"v1",
|
|
"writeuser",
|
|
"interval:today",
|
|
"language:Go"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "WakaTime",
|
|
"item": [
|
|
{
|
|
"name": "Get all time",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.text).to.eql('0 hrs 4 mins');",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/all_time_since_today",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"all_time_since_today"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get all time (unauthenticated)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/all_time_since_today",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"writeuser",
|
|
"all_time_since_today"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (current)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.languages).to.eql(null); // because share_languages is false",
|
|
" pm.expect(jsonData.data.projects.length).to.eql(1);",
|
|
" pm.expect(jsonData.data.branches).to.be.undefined;",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/stats",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"stats"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (filtered)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.projects.length).to.eql(1);",
|
|
" pm.expect(jsonData.data.total_seconds).to.gt(0);",
|
|
" pm.expect(jsonData.data.branches.length).to.eql(1);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/stats?project=wakapi&language=Go",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"stats"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "project",
|
|
"value": "wakapi"
|
|
},
|
|
{
|
|
"key": "language",
|
|
"value": "Go"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (filtered non-matching)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.projects.length).to.eql(0);",
|
|
" pm.expect(jsonData.data.total_seconds).to.eql(0);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/stats?project=wakapi&language=JavaScript",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"stats"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "project",
|
|
"value": "wakapi"
|
|
},
|
|
{
|
|
"key": "language",
|
|
"value": "JavaScript"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get statusbar (current)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.grand_total.text).to.contains(\"0 hrs\");",
|
|
" pm.expect(jsonData.data.categories).to.instanceOf(Array);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/statusbar/today",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"statusbar",
|
|
"today"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (by user)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.projects.length).to.eql(1);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/stats",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"writeuser",
|
|
"stats"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (current, alt 1)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.languages).to.eql(null); // because share_languages is false",
|
|
" pm.expect(jsonData.data.projects.length).to.eql(1);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/v1/users/current/stats/today",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"stats",
|
|
"today"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (range)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.projects.length).to.eql(1);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/stats/last_7_days",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"writeuser",
|
|
"stats",
|
|
"last_7_days"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (out of range)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 403\", function () {",
|
|
" pm.response.to.have.status(403);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/stats/30_days",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"writeuser",
|
|
"stats",
|
|
"30_days"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get stats (not sharing)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 403\", function () {",
|
|
" pm.response.to.have.status(403);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/readuser/stats/today",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"readuser",
|
|
"stats",
|
|
"today"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get projects",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.length).to.eql(1);",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/projects",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current",
|
|
"projects"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get projects (unauthenticated)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/projects",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"writeuser",
|
|
"projects"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get user (current)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct content\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.id).to.eql('writeuser');",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get user (forbidden user)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/readuser",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"readuser"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Get user (unauthenticated)",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 401\", function () {",
|
|
" pm.response.to.have.status(401);",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "noauth"
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"writeuser"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Settings",
|
|
"item": [
|
|
{
|
|
"name": "Use Case: Custom Mappings",
|
|
"item": [
|
|
{
|
|
"name": "1. Login",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body contains string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"Total Time\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": false,
|
|
"followRedirects": true
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "username",
|
|
"value": "writeuser",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password",
|
|
"value": "{{WRITEUSER_PASSWORD}}",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/login",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"login"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "2. Add custom mapping",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body contains string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"Mapping added successfully\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": false,
|
|
"followRedirects": true
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "action",
|
|
"value": "add_mapping",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "extension",
|
|
"value": "go",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "language",
|
|
"value": "Gogo",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/settings",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"settings"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "3. Check summary",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct language\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.languages.length).to.eql(1);",
|
|
" pm.expect(jsonData.languages[0].key).to.eql('Gogo');",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"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": "4. Remove custom mapping",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body contains string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"Mapping deleted successfully\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": false,
|
|
"followRedirects": true
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "action",
|
|
"value": "delete_mapping",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "mapping_id",
|
|
"value": "0",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/settings",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"settings"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "5. Check summary again",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct language\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.languages.length).to.eql(1);",
|
|
" pm.expect(jsonData.languages[0].key).to.eql('Go');",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"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": "Use Case: Change E-Mail",
|
|
"item": [
|
|
{
|
|
"name": "1. Login",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body contains string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"Total Time\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": false,
|
|
"followRedirects": true
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "username",
|
|
"value": "writeuser",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "password",
|
|
"value": "{{WRITEUSER_PASSWORD}}",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/login",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"login"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "2. Set e-mail",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Body contains string\", function () {",
|
|
" pm.expect(pm.response.text()).to.include(\"User updated successfully\");",
|
|
"});"
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"disableCookies": false,
|
|
"followRedirects": true
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [],
|
|
"body": {
|
|
"mode": "urlencoded",
|
|
"urlencoded": [
|
|
{
|
|
"key": "action",
|
|
"value": "update_user",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "location",
|
|
"value": "Europe/Berlin",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "email",
|
|
"value": "foo@example.org",
|
|
"type": "text"
|
|
}
|
|
]
|
|
},
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/settings",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"settings"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "3. Check e-mail",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Status code is 200\", function () {",
|
|
" pm.response.to.have.status(200);",
|
|
"});",
|
|
"",
|
|
"pm.test(\"Correct e-mail address\", function () {",
|
|
" const jsonData = pm.response.json();",
|
|
" pm.expect(jsonData.data.email).to.eql('foo@example.org');",
|
|
"});",
|
|
""
|
|
],
|
|
"type": "text/javascript"
|
|
}
|
|
}
|
|
],
|
|
"protocolProfileBehavior": {
|
|
"tlsPreferServerCiphers": true,
|
|
"disableCookies": true
|
|
},
|
|
"request": {
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{WRITEUSER_TOKEN}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current",
|
|
"host": [
|
|
"{{BASE_URL}}"
|
|
],
|
|
"path": [
|
|
"api",
|
|
"compat",
|
|
"wakatime",
|
|
"v1",
|
|
"users",
|
|
"current"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"event": [
|
|
{
|
|
"listen": "prerequest",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"const moment = require('moment')",
|
|
"",
|
|
"const now = moment()",
|
|
"const startOfDay = moment().startOf('day')",
|
|
"const endOfDay = moment().endOf('day')",
|
|
"const endOfTomorrow = moment().add(1, 'd').endOf('day')",
|
|
"",
|
|
"console.log(`Current timestamp is: ${now.format('x') / 1000}`)",
|
|
"",
|
|
"",
|
|
"// Auth stuff",
|
|
"const readApiKey = pm.variables.get('READUSER_API_KEY')",
|
|
"const writeApiKey = pm.variables.get('WRITEUSER_API_KEY')",
|
|
"",
|
|
"if (!readApiKey || !writeApiKey) {",
|
|
" throw new Error('no api key given')",
|
|
"}",
|
|
"",
|
|
"pm.variables.set('READUSER_TOKEN', base64encode(readApiKey))",
|
|
"pm.variables.set('WRITEUSER_TOKEN', base64encode(writeApiKey))",
|
|
"",
|
|
"function base64encode(str) {",
|
|
" return Buffer.from(str, 'utf-8').toString('base64')",
|
|
"}",
|
|
"",
|
|
"// Heartbeat stuff",
|
|
"pm.variables.set('tsNow', now.format('x') / 1000)",
|
|
"pm.variables.set('tsNowMinus1Min', now.add(-1, 'm').format('x') / 1000)",
|
|
"pm.variables.set('tsNowMinus2Min', now.add(-2, 'm').format('x') / 1000)",
|
|
"pm.variables.set('tsNowMinus3Min', now.add(-3, 'm').format('x') / 1000)",
|
|
"pm.variables.set('tsStartOfDay', startOfDay.format('x') / 1000)",
|
|
"pm.variables.set('tsEndOfDay', endOfDay.format('x') / 1000)",
|
|
"pm.variables.set('tsEndOfTomorrow', endOfTomorrow.format('x') / 1000)",
|
|
"pm.variables.set('tsStartOfDayIso', startOfDay.toISOString())",
|
|
"pm.variables.set('tsEndOfDayIso', endOfDay.toISOString())",
|
|
"pm.variables.set('tsEndOfTomorrowIso', endOfTomorrow.toISOString())",
|
|
"pm.variables.set('tsStartOfDayDate', startOfDay.format('YYYY-MM-DD'))",
|
|
"pm.variables.set('tsEndOfDayDate', endOfDay.format('YYYY-MM-DD'))",
|
|
"pm.variables.set('tsEndOfTomorrowDate', endOfTomorrow.format('YYYY-MM-DD'))",
|
|
"pm.variables.set('ts1', now.startOf('hour').format('x') / 1000)",
|
|
"pm.variables.set('ts2', now.startOf('hour').add(1, 'm').format('x') / 1000)",
|
|
"pm.variables.set('ts3', now.startOf('hour').add(2, 'm').format('x') / 1000)"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"variable": [
|
|
{
|
|
"key": "BASE_URL",
|
|
"value": "http://localhost:3000"
|
|
},
|
|
{
|
|
"key": "READUSER_API_KEY",
|
|
"value": "33e7f538-0dce-4eba-8ffe-53db6814ed42"
|
|
},
|
|
{
|
|
"key": "WRITEUSER_API_KEY",
|
|
"value": "f7aa255c-8647-4d0b-b90f-621c58fd580f"
|
|
},
|
|
{
|
|
"key": "TZ",
|
|
"value": "Europe/Berlin"
|
|
},
|
|
{
|
|
"key": "TZ_OFFSET",
|
|
"value": "+02:00"
|
|
},
|
|
{
|
|
"key": "READUSER_PASSWORD",
|
|
"value": "testpw"
|
|
},
|
|
{
|
|
"key": "WRITEUSER_PASSWORD",
|
|
"value": "testpw"
|
|
}
|
|
]
|
|
} |