MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / TestSearchPackages

Function TestSearchPackages

internal/api/request/client_test.go:45–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func TestSearchPackages(t *testing.T) {
46 server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
47 if req.URL.String() != "/api/packages?limit=1&query=foo" {
48 t.Error("/api/packages?limit=1&query=foo was not called")
49 }
50 fmt.Fprint(rw, "{}")
51 }))
52 defer server.Close()
53
54 client := request.Client{Client: server.Client(), BaseURL: server.URL}
55 _, err := client.SearchPackages("foo", 1)
56 if err != nil {
57 t.Error(err)
58 }
59}
60
61func TestHandleServerError(t *testing.T) {
62 server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {

Callers

nothing calls this directly

Calls 1

SearchPackagesMethod · 0.95

Tested by

no test coverage detected