mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-30 20:50:50 +02:00
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:
@ -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) {
|
||||
|
Reference in New Issue
Block a user