MCPcopy Index your code
hub / github.com/containerd/containerd / TestAddQuery

Function TestAddQuery

core/remotes/docker/resolver_test.go:649–669  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

647}
648
649func TestAddQuery(t *testing.T) {
650 req := &request{path: "/foo"}
651 if err := req.addQuery("bar", "123"); err != nil {
652 t.Fatal(err)
653 }
654 if exp := "/foo?bar=123"; req.path != exp {
655 t.Fatalf("unexpected path %q, expected %q", req.path, exp)
656 }
657 if err := req.addQuery("baz", "456"); err != nil {
658 t.Fatal(err)
659 }
660 if exp := "/foo?bar=123&baz=456"; req.path != exp {
661 t.Fatalf("unexpected path %q, expected %q", req.path, exp)
662 }
663 if err := req.addQuery("baz", "789"); err != nil {
664 t.Fatal(err)
665 }
666 if exp := "/foo?bar=123&baz=456&baz=789"; req.path != exp {
667 t.Fatalf("unexpected path %q, expected %q", req.path, exp)
668 }
669}
670
671func TestRequestSanitize(t *testing.T) {
672 tests := []struct {

Callers

nothing calls this directly

Calls 2

addQueryMethod · 0.95
FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…