test(postman): update api collections

This commit is contained in:
Leon
2025-12-09 15:31:27 +08:00
parent eeafe9d32a
commit c4a81278d0
4 changed files with 103 additions and 136 deletions

View File

@@ -1,8 +1,8 @@
{
"info": {
"name": "FeedSystem Account API",
"_postman_id": "1f4c3ab3-6e6e-4a73-8b28-65f9d73f7dc4",
"description": "Account endpoints for feedsystem_video_go. Run Login first to capture jwt_token for protected calls.",
"_postman_id": "e5572218-8268-4a26-9ad8-77c13c908908",
"description": "Account endpoints without automated scripts. Fill jwt_token manually after calling Login.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
@@ -10,9 +10,7 @@
"name": "Register Account",
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\"\n}"
@@ -26,27 +24,9 @@
},
{
"name": "Login",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"login ok\", function () {",
" pm.response.to.have.status(200);",
" var data = pm.response.json();",
" pm.expect(data.token).to.exist;",
" pm.collectionVariables.set(\"jwt_token\", data.token);",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\"\n}"
@@ -62,9 +42,7 @@
"name": "Change Password",
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{username}}\",\n \"old_password\": \"{{password}}\",\n \"new_password\": \"{{newPassword}}\"\n}"
@@ -80,9 +58,7 @@
"name": "Find Account By ID",
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"id\": {{accountId}}\n}"
@@ -98,9 +74,7 @@
"name": "Find Account By Username",
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"{{username}}\"\n}"
@@ -114,19 +88,6 @@
},
{
"name": "Rename Account (JWT protected)",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"if (!pm.collectionVariables.get(\"jwt_token\")) {",
" throw new Error(\"Please run Login to set jwt_token\");",
"}"
]
}
}
],
"request": {
"method": "POST",
"header": [
@@ -146,19 +107,6 @@
},
{
"name": "Logout (JWT protected)",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"if (!pm.collectionVariables.get(\"jwt_token\")) {",
" throw new Error(\"Please run Login to set jwt_token\");",
"}"
]
}
}
],
"request": {
"method": "POST",
"header": [

View File

@@ -1,31 +1,16 @@
{
"info": {
"name": "FeedSystem Feed API",
"_postman_id": "1cc7b43c-0f0e-4da2-86f2-5e46f8d19803",
"description": "Postman collection for feed endpoints that surface latest videos.",
"_postman_id": "4c2fd555-b880-4b14-8023-55a944936352",
"description": "Feed endpoints without embedded scripts.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "List Latest Feed",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"feed fetched\", function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"limit\": {{feedLimit}},\n \"latest_time\": {{feedLatestTime}}\n}"

88
test/like.json Normal file
View File

@@ -0,0 +1,88 @@
{
"info": {
"name": "FeedSystem Like API",
"_postman_id": "7fd7e0ed-2d7d-4f74-88b2-f48d7f7083b2",
"description": "Like endpoints with manual token management.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Get Likes Count",
"request": {
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"video_id\": {{videoId}}\n}"
},
"url": {
"raw": "{{host}}/like/getLikesCount",
"host": ["{{host}}"],
"path": ["like", "getLikesCount"]
}
}
},
{
"name": "Is Liked (JWT protected)",
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" },
{ "key": "Authorization", "value": "Bearer {{jwt_token}}" }
],
"body": {
"mode": "raw",
"raw": "{\n \"video_id\": {{videoId}}\n}"
},
"url": {
"raw": "{{host}}/like/isLiked",
"host": ["{{host}}"],
"path": ["like", "isLiked"]
}
}
},
{
"name": "Like Video (JWT protected)",
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" },
{ "key": "Authorization", "value": "Bearer {{jwt_token}}" }
],
"body": {
"mode": "raw",
"raw": "{\n \"video_id\": {{videoId}}\n}"
},
"url": {
"raw": "{{host}}/like/like",
"host": ["{{host}}"],
"path": ["like", "like"]
}
}
},
{
"name": "Unlike Video (JWT protected)",
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" },
{ "key": "Authorization", "value": "Bearer {{jwt_token}}" }
],
"body": {
"mode": "raw",
"raw": "{\n \"video_id\": {{videoId}}\n}"
},
"url": {
"raw": "{{host}}/like/unlike",
"host": ["{{host}}"],
"path": ["like", "unlike"]
}
}
}
],
"variable": [
{ "key": "host", "value": "http://localhost:8080" },
{ "key": "videoId", "value": "1" },
{ "key": "jwt_token", "value": "" }
]
}

View File

@@ -1,31 +1,16 @@
{
"info": {
"name": "FeedSystem Video API",
"_postman_id": "05c51174-a3e4-4c86-9a79-2b0ca8856106",
"description": "Postman collection for video endpoints, including public queries and the JWT-protected publish action.",
"_postman_id": "8294cdbd-2324-4cac-8768-6bf2157d272b",
"description": "Video endpoints without embedded scripts. Supply jwt_token manually for publish request.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "List Videos By Author ID",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"author videos fetched\", function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"author_id\": {{authorId}}\n}"
@@ -39,24 +24,9 @@
},
{
"name": "Get Video Detail",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"video detail fetched\", function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [
{ "key": "Content-Type", "value": "application/json" }
],
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"id\": {{videoId}}\n}"
@@ -70,30 +40,6 @@
},
{
"name": "Publish Video (JWT protected)",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"if (!pm.collectionVariables.get(\"jwt_token\")) {",
" throw new Error(\"Set jwt_token first (usually the login API response)\");",
"}"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"video published\", function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [
@@ -102,7 +48,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"title\": \"demo video\",\n \"description\": \"auto generated via Postman\",\n \"play_url\": \"http://example.com/demo.mp4\"\n}"
"raw": "{\n \"title\": \"demo video\",\n \"description\": \"manual request\",\n \"play_url\": \"http://example.com/demo.mp4\"\n}"
},
"url": {
"raw": "{{host}}/video/publish",