(t *testing.T)
| 255 | } |
| 256 | |
| 257 | func TestManager_Run(t *testing.T) { |
| 258 | tests := map[string]struct { |
| 259 | register []string |
| 260 | input string |
| 261 | expected []Function |
| 262 | }{ |
| 263 | "valid function: single": { |
| 264 | register: []string{"fn1"}, |
| 265 | input: fmt.Sprintf(` |
| 266 | FUNCTION UID 1 "fn1 arg1 arg2" %s "%s" |
| 267 | `, managerTestPermissions, managerTestSource), |
| 268 | expected: []Function{ |
| 269 | { |
| 270 | key: lineFunction, |
| 271 | UID: "UID", |
| 272 | Timeout: time.Second, |
| 273 | Name: "fn1", |
| 274 | Args: []string{"arg1", "arg2"}, |
| 275 | Permissions: managerTestPermissions, |
| 276 | Source: managerTestSource, |
| 277 | ContentType: "", |
| 278 | Payload: nil, |
| 279 | }, |
| 280 | }, |
| 281 | }, |
| 282 | "valid function: multiple": { |
| 283 | register: []string{"fn1", "fn2"}, |
| 284 | input: fmt.Sprintf(` |
| 285 | FUNCTION UID1 1 "fn1 arg1 arg2" %s "%s" |
| 286 | FUNCTION UID2 1 "fn2 arg1 arg2" %s "%s" |
| 287 | `, managerTestPermissions, managerTestSource, managerTestPermissions, managerTestSource), |
| 288 | expected: []Function{ |
| 289 | { |
| 290 | key: lineFunction, |
| 291 | UID: "UID1", |
| 292 | Timeout: time.Second, |
| 293 | Name: "fn1", |
| 294 | Args: []string{"arg1", "arg2"}, |
| 295 | Permissions: managerTestPermissions, |
| 296 | Source: managerTestSource, |
| 297 | ContentType: "", |
| 298 | Payload: nil, |
| 299 | }, |
| 300 | { |
| 301 | key: lineFunction, |
| 302 | UID: "UID2", |
| 303 | Timeout: time.Second, |
| 304 | Name: "fn2", |
| 305 | Args: []string{"arg1", "arg2"}, |
| 306 | Permissions: managerTestPermissions, |
| 307 | Source: managerTestSource, |
| 308 | ContentType: "", |
| 309 | Payload: nil, |
| 310 | }, |
| 311 | }, |
| 312 | }, |
| 313 | "valid function: single with payload": { |
| 314 | register: []string{"fn1", "fn2"}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…