Started adding update tests
continuous-integration/drone/push Build is failing Details

This commit is contained in:
konrad 2019-04-12 22:24:07 +02:00
parent 806bc955f2
commit 5f0b735662
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 6 additions and 6 deletions

View File

@ -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) {
})

View File

@ -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)
}