MCPcopy
hub / github.com/GopeedLab/gopeed / TestCreateDirectTask

Function TestCreateDirectTask

pkg/rest/server_test.go:118–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

116}
117
118func TestCreateDirectTask(t *testing.T) {
119 doTest(func() {
120 var wg sync.WaitGroup
121 wg.Add(1)
122 Downloader.Listener(func(event *download.Event) {
123 if event.Key == download.EventKeyFinally {
124 wg.Done()
125 }
126 })
127
128 taskId := httpRequestCheckOk[string](http.MethodPost, "/api/v1/tasks", createReq)
129 if taskId == "" {
130 t.Fatal("create task failed")
131 }
132
133 wg.Wait()
134 want := test.FileMd5(test.BuildFile)
135 got := test.FileMd5(test.DownloadFile)
136 if want != got {
137 t.Errorf("CreateDirectTask() got = %v, want %v", got, want)
138 }
139 })
140}
141
142func TestCreateDirectTaskBatch(t *testing.T) {
143 doTest(func() {

Callers

nothing calls this directly

Calls 4

FileMd5Function · 0.92
doTestFunction · 0.85
WaitMethod · 0.65
ListenerMethod · 0.45

Tested by

no test coverage detected