test:編寫Postman API測試文件
This commit is contained in:
@@ -0,0 +1,501 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "CFDivePlatform API Tests",
|
||||||
|
"description": "CFDivePlatform API 測試集合 - 包含會員、服務提供者、管理員等完整測試案例",
|
||||||
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||||
|
},
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "基礎測試",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "Ping Test",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/ping",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "ping"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Test POST",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"name\": \"測試用戶\",\n \"value\": \"123\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/testpost",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "testpost"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "會員認證",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "會員註冊",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"name\": \"測試會員\",\n \"email\": \"member@test.com\",\n \"password\": \"password123\",\n \"password_confirmation\": \"password123\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/member/register",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "member", "register"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "會員登入",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"email\": \"member@test.com\",\n \"password\": \"password123\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/member/login",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "member", "login"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "取得會員資料",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{member_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/member/profile",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "member", "profile"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "會員專屬 API",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "會員登出",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{member_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/member/logout",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "member", "logout"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "更新會員個人資料",
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{member_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"name\": \"更新後的會員名稱\",\n \"phone\": \"0912345678\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/member/profile",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "member", "profile"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "修改會員密碼",
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{member_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"current_password\": \"password123\",\n \"new_password\": \"newpassword123\",\n \"new_password_confirmation\": \"newpassword123\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/member/change-password",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "member", "change-password"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "服務提供者認證",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "服務提供者註冊",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"name\": \"測試教練\",\n \"email\": \"{{test_provider_email}}\",\n \"password\": \"{{test_password}}\",\n \"password_confirmation\": \"{{test_password}}\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/provider/register",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "provider", "register"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "服務提供者登入",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"email\": \"{{test_provider_email}}\",\n \"password\": \"{{test_password}}\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/provider/login",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "provider", "login"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "服務提供者專屬 API",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "服務提供者登出",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{provider_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/provider/logout",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "provider", "logout"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "取得服務提供者資料",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{provider_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/provider/profile",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "provider", "profile"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "管理員認證",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "管理員註冊",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"name\": \"測試管理員\",\n \"email\": \"{{test_admin_email}}\",\n \"password\": \"{{test_password}}\",\n \"password_confirmation\": \"{{test_password}}\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/admin/register",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "admin", "register"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "管理員登入",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"email\": \"{{test_admin_email}}\",\n \"password\": \"{{test_password}}\"\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/admin/login",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "admin", "login"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "管理員專屬 API",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "查詢會員資料",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{admin_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/admin/check-member/1",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "admin", "check-member", "1"],
|
||||||
|
"variable": [
|
||||||
|
{
|
||||||
|
"key": "id",
|
||||||
|
"value": "1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "查詢服務提供者資料",
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Authorization",
|
||||||
|
"value": "Bearer {{admin_token}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/api/admin/check-provider/1",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": ["localhost"],
|
||||||
|
"port": "8080",
|
||||||
|
"path": ["api", "admin", "check-provider", "1"],
|
||||||
|
"variable": [
|
||||||
|
{
|
||||||
|
"key": "id",
|
||||||
|
"value": "1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"variable": [
|
||||||
|
{
|
||||||
|
"key": "base_url",
|
||||||
|
"value": "http://localhost:8080/api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "member_token",
|
||||||
|
"value": "",
|
||||||
|
"description": "會員登入後設定"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "provider_token",
|
||||||
|
"value": "",
|
||||||
|
"description": "服務提供者登入後設定"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "admin_token",
|
||||||
|
"value": "",
|
||||||
|
"description": "管理員登入後設定"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "test_member_email",
|
||||||
|
"value": "member@test.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "test_provider_email",
|
||||||
|
"value": "provider@test.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "test_admin_email",
|
||||||
|
"value": "admin@test.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "test_password",
|
||||||
|
"value": "password123"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user