Delete strain.
This commit is contained in:
parent
ff0e37d2ef
commit
df95dfc930
9 changed files with 141 additions and 0 deletions
|
@ -148,3 +148,32 @@ func TestStrainService_Update(t *testing.T) {
|
|||
t.Fatal("!called")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrainService_Delete(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
||||
want := newStrain()
|
||||
|
||||
var called bool
|
||||
mux.HandleFunc(urlPath(t, router.DeleteStrain, map[string]string{"Id": "1"}), func(w http.ResponseWriter, r *http.Request) {
|
||||
called = true
|
||||
testMethod(t, r, "DELETE")
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
writeJSON(w, want)
|
||||
})
|
||||
|
||||
deleted, err := client.Strains.Delete(want.Id)
|
||||
if err != nil {
|
||||
t.Errorf("Strains.Delete returned error: %v", err)
|
||||
}
|
||||
|
||||
if !deleted {
|
||||
t.Error("!deleted")
|
||||
}
|
||||
|
||||
if !called {
|
||||
t.Fatal("!called")
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue