MCPcopy
hub / github.com/iron-io/functions / TestGetTaskError

Function TestGetTaskError

api/runner/async_runner_test.go:113–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

111}
112
113func TestGetTaskError(t *testing.T) {
114 buf := setLogBuffer()
115
116 tests := []map[string]interface{}{
117 {
118 "url": "/invalid",
119 "task": getMockTask(),
120 "error": "invalid character 'p' after top-level value",
121 },
122 }
123
124 var tasks []*models.Task
125 for _, v := range tests {
126 task := v["task"].(models.Task)
127 tasks = append(tasks, &task)
128 }
129
130 ts := getTestServer(tasks)
131 defer ts.Close()
132
133 for i, test := range tests {
134 url := ts.URL + test["url"].(string)
135 _, err := getTask(context.Background(), url)
136 if err == nil {
137 t.Log(buf.String())
138 t.Errorf("expected error '%s'", test["error"].(string))
139 }
140 if err.Error() != test["error"].(string) {
141 t.Log(buf.String())
142 t.Errorf("test %d: expected error '%s', got '%s'", i, test["error"].(string), err)
143 }
144 }
145}
146
147func TestDeleteTask(t *testing.T) {
148 buf := setLogBuffer()

Callers

nothing calls this directly

Calls 7

getMockTaskFunction · 0.85
getTestServerFunction · 0.85
getTaskFunction · 0.85
CloseMethod · 0.80
setLogBufferFunction · 0.70
LogMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…