(t *testing.T)
| 90 | } |
| 91 | |
| 92 | func TestRESTWithFullURL(t *testing.T) { |
| 93 | http := &httpmock.Registry{} |
| 94 | client := newTestClient(http) |
| 95 | |
| 96 | http.Register( |
| 97 | httpmock.REST("GET", "api/v3/user/repos"), |
| 98 | httpmock.StatusStringResponse(200, "{}")) |
| 99 | http.Register( |
| 100 | httpmock.REST("GET", "user/repos"), |
| 101 | httpmock.StatusStringResponse(200, "{}")) |
| 102 | |
| 103 | err := client.REST("example.com", "GET", "user/repos", nil, nil) |
| 104 | assert.NoError(t, err) |
| 105 | err = client.REST("example.com", "GET", "https://another.net/user/repos", nil, nil) |
| 106 | assert.NoError(t, err) |
| 107 | |
| 108 | assert.Equal(t, "example.com", http.Requests[0].URL.Hostname()) |
| 109 | assert.Equal(t, "another.net", http.Requests[1].URL.Hostname()) |
| 110 | } |
| 111 | |
| 112 | func TestRESTError(t *testing.T) { |
| 113 | fakehttp := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected