Delete an observation

This commit is contained in:
Matthew Dillon 2014-11-21 18:58:07 -09:00
parent b90da728fe
commit 952224e2df
9 changed files with 141 additions and 0 deletions

View file

@ -124,3 +124,30 @@ func TestObservation_Update(t *testing.T) {
t.Error("!success")
}
}
func TestObservation_Delete(t *testing.T) {
setup()
want := newObservation()
calledDelete := false
store.Observations.(*models.MockObservationsService).Delete_ = func(id int64) (bool, error) {
if id != want.Id {
t.Errorf("wanted request for observation %d but got %d", want.Id, id)
}
calledDelete = true
return true, nil
}
success, err := apiClient.Observations.Delete(want.Id)
if err != nil {
t.Fatal(err)
}
if !calledDelete {
t.Error("!calledDelete")
}
if !success {
t.Error("!success")
}
}