MCPcopy
hub / github.com/syncthing/syncthing / expectURLToContain

Function expectURLToContain

lib/api/api_test.go:177–200  ·  view source on GitHub ↗
(t *testing.T, url, exp string)

Source from the content-addressed store, hash-verified

175}
176
177func expectURLToContain(t *testing.T, url, exp string) {
178 res, err := http.Get(url)
179 if err != nil {
180 t.Error(err)
181 return
182 }
183
184 if res.StatusCode != 200 {
185 t.Errorf("Got %s instead of 200 OK", res.Status)
186 return
187 }
188
189 data, err := io.ReadAll(res.Body)
190 res.Body.Close()
191 if err != nil {
192 t.Error(err)
193 return
194 }
195
196 if string(data) != exp {
197 t.Errorf("Got %q instead of %q on %q", data, exp, url)
198 return
199 }
200}
201
202func TestDirNames(t *testing.T) {
203 t.Parallel()

Callers 1

TestAssetsDirFunction · 0.85

Calls 3

GetMethod · 0.65
ErrorMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected