(t *testing.T)
| 64 | } |
| 65 | |
| 66 | func TestAddMulti(t *testing.T) { |
| 67 | c := aetesting.FakeSingleContext(t, "taskqueue", "BulkAdd", func(req *pb.TaskQueueBulkAddRequest, res *pb.TaskQueueBulkAddResponse) error { |
| 68 | res.Taskresult = []*pb.TaskQueueBulkAddResponse_TaskResult{ |
| 69 | { |
| 70 | Result: pb.TaskQueueServiceError_OK.Enum(), |
| 71 | }, |
| 72 | { |
| 73 | Result: pb.TaskQueueServiceError_TASK_ALREADY_EXISTS.Enum(), |
| 74 | }, |
| 75 | { |
| 76 | Result: pb.TaskQueueServiceError_TOMBSTONED_TASK.Enum(), |
| 77 | }, |
| 78 | { |
| 79 | Result: pb.TaskQueueServiceError_INTERNAL_ERROR.Enum(), |
| 80 | }, |
| 81 | } |
| 82 | return nil |
| 83 | }) |
| 84 | tasks := []*Task{ |
| 85 | {Path: "/worker", Method: "PULL"}, |
| 86 | {Path: "/worker", Method: "PULL"}, |
| 87 | {Path: "/worker", Method: "PULL"}, |
| 88 | {Path: "/worker", Method: "PULL"}, |
| 89 | } |
| 90 | r, err := AddMulti(c, tasks, "a-queue") |
| 91 | if len(r) != len(tasks) { |
| 92 | t.Fatalf("AddMulti returned %d tasks, want %d", len(r), len(tasks)) |
| 93 | } |
| 94 | want := appengine.MultiError{ |
| 95 | nil, |
| 96 | ErrTaskAlreadyAdded, |
| 97 | ErrTaskAlreadyAdded, |
| 98 | &internal.APIError{ |
| 99 | Service: "taskqueue", |
| 100 | Code: int32(pb.TaskQueueServiceError_INTERNAL_ERROR), |
| 101 | }, |
| 102 | } |
| 103 | if !reflect.DeepEqual(err, want) { |
| 104 | t.Errorf("AddMulti got %v, wanted %v", err, want) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | func TestAddWithEmptyPath(t *testing.T) { |
| 109 | c := aetesting.FakeSingleContext(t, "taskqueue", "Add", func(req *pb.TaskQueueAddRequest, res *pb.TaskQueueAddResponse) error { |
nothing calls this directly
no test coverage detected
searching dependent graphs…