From 5f0b735662250b28c12fabc375c1f901f51b0610 Mon Sep 17 00:00:00 2001 From: konrad Date: Fri, 12 Apr 2019 22:24:07 +0200 Subject: [PATCH] Started adding update tests --- pkg/integrations/list_test.go | 7 ++++++- pkg/models/list_create_update.go | 5 ----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/integrations/list_test.go b/pkg/integrations/list_test.go index fc06a42e0..161606349 100644 --- a/pkg/integrations/list_test.go +++ b/pkg/integrations/list_test.go @@ -140,8 +140,13 @@ func TestList(t *testing.T) { t.Run("Update", func(t *testing.T) { t.Run("Normal", func(t *testing.T) { // Check the list was loaded sucessfully afterwards, see testReadOne - + rec, err := testHandler.testUpdate(nil, map[string]string{"list": "1"}, `{"title":"TestLoremIpsum"}`) + assert.NoError(t, err) + assert.Contains(t, rec.Body.String(), `"title":"TestLoremIpsum"`) }) + // TODO: empty title, min/maxlength of the title & description + // Also test with only one parameter + // Test chaning the owner t.Run("Nonexisting", func(t *testing.T) { }) diff --git a/pkg/models/list_create_update.go b/pkg/models/list_create_update.go index bbdf6c24e..20e3aa934 100644 --- a/pkg/models/list_create_update.go +++ b/pkg/models/list_create_update.go @@ -73,11 +73,6 @@ func CreateOrUpdateList(list *List) (err error) { // @Failure 500 {object} models.Message "Internal error" // @Router /lists/{id} [post] func (l *List) Update() (err error) { - // Check if it exists - lorig := List{ID: l.ID} - if err = lorig.GetSimpleByID(); err != nil { - return - } return CreateOrUpdateList(l) }