(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func 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 | } |
nothing calls this directly
no test coverage detected