Add back in the bootstrap handler since I realized it is still useful to provide some amount of history at first install immediately

This commit is contained in:
David Dworken
2022-04-28 11:05:56 -07:00
parent da30659f64
commit 8a018b71b8
2 changed files with 30 additions and 0 deletions

View File

@ -97,6 +97,19 @@ func TestESubmitThenQuery(t *testing.T) {
if !data.EntryEquals(decEntry, entry) {
t.Fatalf("DB data is different than input! \ndb =%#v\ninput=%#v", *dbEntry, entry)
}
// Bootstrap handler should return 2 entries, one for each device
w = httptest.NewRecorder()
searchReq = httptest.NewRequest(http.MethodGet, "/?user_id="+data.UserId("key")+"&device_id="+devId1, nil)
apiEBootstrapHandler(w, searchReq)
res = w.Result()
defer res.Body.Close()
respBody, err = ioutil.ReadAll(res.Body)
shared.Check(t, err)
shared.Check(t, json.Unmarshal(respBody, &retrievedEntries))
if len(retrievedEntries) != 2 {
t.Fatalf("Expected to retrieve 2 entries, found %d", len(retrievedEntries))
}
}
func TestDumpRequestAndResponse(t *testing.T) {