(t *testing.T)
| 195 | } |
| 196 | |
| 197 | func TestRunningFunction(t *testing.T) { |
| 198 | c := newFakeContext() |
| 199 | |
| 200 | // Fake out the adding of a task. |
| 201 | var task *taskqueue.Task |
| 202 | taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { |
| 203 | if queue != "" { |
| 204 | t.Errorf(`Got queue %q, expected ""`, queue) |
| 205 | } |
| 206 | task = tk |
| 207 | return tk, nil |
| 208 | } |
| 209 | |
| 210 | regFuncRuns, regFuncMsg = 0, "" // reset state |
| 211 | const msg = "Why, hello!" |
| 212 | regFunc.Call(c.ctx, msg) |
| 213 | |
| 214 | // Simulate the Task Queue service. |
| 215 | req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) |
| 216 | if err != nil { |
| 217 | t.Fatalf("Failed making http.Request: %v", err) |
| 218 | } |
| 219 | rw := httptest.NewRecorder() |
| 220 | runFunc(c.ctx, rw, req) |
| 221 | |
| 222 | if regFuncRuns != 1 { |
| 223 | t.Errorf("regFuncRuns: got %d, want 1", regFuncRuns) |
| 224 | } |
| 225 | if regFuncMsg != msg { |
| 226 | t.Errorf("regFuncMsg: got %q, want %q", regFuncMsg, msg) |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | func TestCustomType(t *testing.T) { |
| 231 | c := newFakeContext() |
nothing calls this directly
no test coverage detected
searching dependent graphs…