MCPcopy Index your code
hub / github.com/google/go-github / TestResponse_populatePageValues_invalid

Function TestResponse_populatePageValues_invalid

github/github_test.go:2085–2124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2083}
2084
2085func TestResponse_populatePageValues_invalid(t *testing.T) {
2086 t.Parallel()
2087 r := http.Response{
2088 Header: http.Header{
2089 "Link": {
2090 `<https://api.github.com/?page=1>,` +
2091 `<https://api.github.com/?page=abc>; rel="first",` +
2092 `https://api.github.com/?page=2; rel="prev",` +
2093 `<https://api.github.com/>; rel="next",` +
2094 `<https://api.github.com/?page=>; rel="last"`,
2095 },
2096 },
2097 }
2098
2099 response := newResponse(&r)
2100 if got, want := response.FirstPage, 0; got != want {
2101 t.Errorf("response.FirstPage: %v, want %v", got, want)
2102 }
2103 if got, want := response.PrevPage, 0; got != want {
2104 t.Errorf("response.PrevPage: %v, want %v", got, want)
2105 }
2106 if got, want := response.NextPage, 0; got != want {
2107 t.Errorf("response.NextPage: %v, want %v", got, want)
2108 }
2109 if got, want := response.LastPage, 0; got != want {
2110 t.Errorf("response.LastPage: %v, want %v", got, want)
2111 }
2112
2113 // more invalid URLs
2114 r = http.Response{
2115 Header: http.Header{
2116 "Link": {`<https://api.github.com/%?page=2>; rel="first"`},
2117 },
2118 }
2119
2120 response = newResponse(&r)
2121 if got, want := response.FirstPage, 0; got != want {
2122 t.Errorf("response.FirstPage: %v, want %v", got, want)
2123 }
2124}
2125
2126func TestResponse_populateSinceValues_invalid(t *testing.T) {
2127 t.Parallel()

Callers

nothing calls this directly

Calls 1

newResponseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…