(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func TestGetKey(t *testing.T) { |
| 64 | t.Parallel() |
| 65 | req := httptest.NewRequest("GET", testBaseString+"/api/v1/cache/getKey", nil) |
| 66 | rr := httptest.NewRecorder() |
| 67 | |
| 68 | // set something. |
| 69 | cache.Set("getKey", []byte("123")) |
| 70 | |
| 71 | getCacheHandler(rr, req) |
| 72 | resp := rr.Result() |
| 73 | |
| 74 | body, err := ioutil.ReadAll(resp.Body) |
| 75 | if err != nil { |
| 76 | t.Errorf("cannot deserialise test response: %s", err) |
| 77 | } |
| 78 | |
| 79 | if string(body) != "123" { |
| 80 | t.Errorf("want: 123; got: %s.\n\tcan't get existing key getKey.", string(body)) |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | func TestPutKey(t *testing.T) { |
| 85 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…