(t *testing.T)
| 105 | } |
| 106 | |
| 107 | func Test_canGoThroughProxy(t *testing.T) { |
| 108 | basecache := "testcache" |
| 109 | version := "1.1.1" |
| 110 | |
| 111 | config := setup(t, basecache, version) |
| 112 | defer teardown(t, basecache) |
| 113 | |
| 114 | config.Set(configuration.INSECURE_HTTPS, false) |
| 115 | |
| 116 | wp, err := proxy.NewWrapperProxy(config, version, &debugLogger, caData) |
| 117 | assert.Nil(t, err) |
| 118 | |
| 119 | err = wp.Start() |
| 120 | assert.Nil(t, err) |
| 121 | |
| 122 | useProxyAuth := true |
| 123 | proxiedClient, err := helper_getHttpClient(wp, useProxyAuth) |
| 124 | assert.Nil(t, err) |
| 125 | |
| 126 | res, err := proxiedClient.Get("https://downloads.snyk.io/cli/latest/version") |
| 127 | if err != nil { |
| 128 | t.Fatal(err) |
| 129 | } |
| 130 | defer func() { |
| 131 | if res != nil && res.Body != nil { |
| 132 | _ = res.Body.Close() |
| 133 | } |
| 134 | }() |
| 135 | |
| 136 | assert.Equal(t, 200, res.StatusCode) |
| 137 | |
| 138 | wp.Close() |
| 139 | } |
| 140 | |
| 141 | func Test_proxyRejectsWithoutBasicAuthHeader(t *testing.T) { |
| 142 | basecache := "testcache" |
nothing calls this directly
no test coverage detected