(t *testing.T)
| 821 | } |
| 822 | |
| 823 | func TestNewCachedDetector(t *testing.T) { |
| 824 | reg := &httpmock.Registry{} |
| 825 | defer reg.Verify(t) |
| 826 | var gotHeader string |
| 827 | reg.Register( |
| 828 | httpmock.WithHost(httpmock.REST("GET", "api/v3/meta"), "git.my.org"), |
| 829 | func(req *http.Request) (*http.Response, error) { |
| 830 | gotHeader = req.Header.Get("X-GH-CACHE-TTL") |
| 831 | return httpmock.JSONResponse(map[string]string{"installed_version": "3.23.0"})(req) |
| 832 | }, |
| 833 | ) |
| 834 | |
| 835 | _, err := NewCachedDetector(&http.Client{Transport: reg}, "git.my.org", 24*time.Hour).AuthFeatures() |
| 836 | require.NoError(t, err) |
| 837 | assert.Equal(t, "24h0m0s", gotHeader) |
| 838 | } |
| 839 | |
| 840 | func TestDetectorClient(t *testing.T) { |
| 841 | tests := []struct { |
nothing calls this directly
no test coverage detected