(t *testing.T, datatype string, argument string, value string)
| 577 | } |
| 578 | |
| 579 | func RequestWithPathParameterDataType(t *testing.T, datatype string, argument string, value string) { |
| 580 | definition := ` |
| 581 | paths: |
| 582 | /ping/{id}: |
| 583 | parameters: |
| 584 | - name: id |
| 585 | in: path |
| 586 | required: true |
| 587 | description: The id |
| 588 | schema: |
| 589 | type: ` + datatype + ` |
| 590 | get: |
| 591 | operationId: ping |
| 592 | summary: Simple ping |
| 593 | ` |
| 594 | context := NewContextBuilder(). |
| 595 | WithResponse(http.StatusOK, "{}"). |
| 596 | WithDefinition("myservice", definition). |
| 597 | Build() |
| 598 | |
| 599 | result := RunCli([]string{"myservice", "ping", "--id", argument}, context) |
| 600 | |
| 601 | expected := `/ping/` + value |
| 602 | if result.RequestUrl != expected { |
| 603 | t.Errorf("Invalid request url, expected: %v, got: %v", expected, result.RequestUrl) |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | func TestRequestWithQueryStringDataTypes(t *testing.T) { |
| 608 | t.Run("String", func(t *testing.T) { RequestWithQueryStringDataTypes(t, "string", "myvalue", "myvalue") }) |
no test coverage detected