(t *testing.T, itemsType string, argument string, pathValue string)
| 401 | } |
| 402 | |
| 403 | func CommaSeparatedArrayArgument(t *testing.T, itemsType string, argument string, pathValue string) { |
| 404 | definition := ` |
| 405 | paths: |
| 406 | /ping/{ids}: |
| 407 | parameters: |
| 408 | - name: ids |
| 409 | in: path |
| 410 | required: true |
| 411 | description: The ids |
| 412 | schema: |
| 413 | type: array |
| 414 | items: |
| 415 | type: ` + itemsType + ` |
| 416 | get: |
| 417 | operationId: ping |
| 418 | summary: Simple ping |
| 419 | ` |
| 420 | context := NewContextBuilder(). |
| 421 | WithResponse(http.StatusOK, "{}"). |
| 422 | WithDefinition("myservice", definition). |
| 423 | Build() |
| 424 | |
| 425 | result := RunCli([]string{"myservice", "ping", "--ids", argument}, context) |
| 426 | |
| 427 | expected := "/ping/" + pathValue |
| 428 | if result.RequestUrl != expected { |
| 429 | t.Errorf("Invalid request url, expected: %v, got: %v", expected, result.RequestUrl) |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | func TestMultipleArgumentsArray(t *testing.T) { |
| 434 | t.Run("StringArray", func(t *testing.T) { |
no test coverage detected