feat(test):新增管理端API自动化测试
This commit is contained in:
1 parent
706b2da5b4
commit
104f1de0b3
36 files changed
+4195
No files matched your search
@@ -0,0 +1,49 @@
|
||||
//go:build integration
|
||||
|
||||
package admin_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/qianfree/team-api/tests/integration/admin/testinfra"
|
||||
)
|
||||
|
||||
func TestTaskList(t *testing.T) {
|
||||
client := testinfra.GetAuthedClient(t)
|
||||
|
||||
resp := client.Get("/api/admin/tasks", map[string]string{
|
||||
"page": "1",
|
||||
"page_size": "10",
|
||||
})
|
||||
testinfra.AssertPaginatedList(t, resp, 0)
|
||||
}
|
||||
|
||||
func TestTaskListWithFilters(t *testing.T) {
|
||||
client := testinfra.GetAuthedClient(t)
|
||||
|
||||
// Filter by status
|
||||
resp := client.Get("/api/admin/tasks", map[string]string{
|
||||
"page": "1",
|
||||
"page_size": "10",
|
||||
"status": "completed",
|
||||
})
|
||||
resp.AssertSuccess(t)
|
||||
|
||||
// Filter by platform
|
||||
resp = client.Get("/api/admin/tasks", map[string]string{
|
||||
"page": "1",
|
||||
"page_size": "10",
|
||||
"platform": "suno",
|
||||
})
|
||||
resp.AssertSuccess(t)
|
||||
|
||||
// Filter by public_task_id
|
||||
resp = client.Get("/api/admin/tasks", map[string]string{
|
||||
"page": "1",
|
||||
"page_size": "10",
|
||||
"public_task_id": "nonexistent",
|
||||
})
|
||||
resp.AssertSuccess(t)
|
||||
|
||||
t.Logf("Task list filters applied successfully")
|
||||
}
|
||||
Reference in new issue
Block a user