(t *testing.T, datatype string, argument string, value string)
| 612 | } |
| 613 | |
| 614 | func RequestWithQueryStringDataTypes(t *testing.T, datatype string, argument string, value string) { |
| 615 | definition := ` |
| 616 | paths: |
| 617 | /ping: |
| 618 | parameters: |
| 619 | - name: filter |
| 620 | in: query |
| 621 | required: true |
| 622 | description: The filter |
| 623 | schema: |
| 624 | type: ` + datatype + ` |
| 625 | get: |
| 626 | operationId: ping |
| 627 | summary: Simple ping |
| 628 | ` |
| 629 | context := NewContextBuilder(). |
| 630 | WithResponse(http.StatusOK, "{}"). |
| 631 | WithDefinition("myservice", definition). |
| 632 | Build() |
| 633 | |
| 634 | result := RunCli([]string{"myservice", "ping", "--filter", argument}, context) |
| 635 | |
| 636 | expected := `/ping?filter=` + value |
| 637 | if result.RequestUrl != expected { |
| 638 | t.Errorf("Invalid request url, expected: %v, got: %v", expected, result.RequestUrl) |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | func TestRequestWithHeaderDataTypes(t *testing.T) { |
| 643 | t.Run("String", func(t *testing.T) { RequestWithHeaderDataTypes(t, "string", "myvalue", "myvalue") }) |
no test coverage detected