8784: Fix test for latest firefox.
[arvados.git] / services / keepstore / status_test.go
1 package main
2
3 import (
4         "encoding/json"
5 )
6
7 // We don't have isolated unit tests for /status.json yet, but we do
8 // check (e.g., in pull_worker_test.go) that /status.json reports
9 // specific statistics correctly at the appropriate times.
10
11 // getStatusItem("foo","bar","baz") retrieves /status.json, decodes
12 // the response body into resp, and returns resp["foo"]["bar"]["baz"].
13 func getStatusItem(keys ...string) interface{} {
14         resp := IssueRequest(&RequestTester{"/status.json", "", "GET", nil})
15         var s interface{}
16         json.NewDecoder(resp.Body).Decode(&s)
17         for _, k := range keys {
18                 s = s.(map[string]interface{})[k]
19         }
20         return s
21 }