MCPcopy
hub / github.com/NVIDIA/aistore / TestReparseQuery

Function TestReparseQuery

cmn/tests/url_test.go:33–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestReparseQuery(t *testing.T) {
34 const (
35 versionID = "1"
36 uuid = "R9oLVoEsxx"
37 basePath = "/s3/imagenet-tar/oisubset-train-0000.tar"
38 )
39
40 r := &http.Request{
41 Method: http.MethodGet,
42 URL: &url.URL{
43 Path: fmt.Sprintf("%s?%s=%s", basePath, apc.QparamUUID, uuid),
44 },
45 }
46 q := url.Values{}
47 q.Add("versionID", versionID)
48 r.URL.RawQuery = q.Encode()
49
50 cos.ReparseQuery(r)
51 actualVersionID, actualUUID := r.URL.Query().Get("versionID"), r.URL.Query().Get(apc.QparamUUID)
52 tassert.Errorf(t, actualVersionID == versionID, "expected versionID to be %q, got %q", versionID, actualVersionID)
53 tassert.Errorf(t, actualUUID == uuid, "expected %s to be %q, got %q", apc.QparamUUID, uuid, actualUUID)
54 tassert.Errorf(t, r.URL.Path == basePath, "expected path to be %q, got %q", basePath, r.URL.Path)
55}

Callers

nothing calls this directly

Calls 4

ReparseQueryFunction · 0.92
ErrorfFunction · 0.92
AddMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected