diff --git a/database/sqlite/database_test.go b/database/sqlite/database_test.go index 72f671a..632087e 100644 --- a/database/sqlite/database_test.go +++ b/database/sqlite/database_test.go @@ -13,7 +13,7 @@ const ( testRMsg = "lol" ) -func genTestDB() (db *sqlite.SQLiteDatabase, err error) { +func genTestDB() (db guestbook.Guestbook, err error) { db, err = sqlite.New(":memory:") if err != nil { return nil, errors.Wrap(err, "failed to init DB") @@ -65,7 +65,7 @@ func TestSqliteInsertAndGetAll(t *testing.T) { } } -func TestSqliteUpdateEntry(t *testing.T) { +func TestSqliteEditEntry(t *testing.T) { db, err := genTestDB() if err != nil { t.Error(err) @@ -86,13 +86,13 @@ func TestSqliteUpdateEntry(t *testing.T) { me.ID = es0[0].ID me.Name = "NotSoAnonymous" - err = db.UpdateEntry(me) + err = db.EditEntry(me) if err != nil { t.Error(err) } } -func TestSqliteUpdateReply(t *testing.T) { +func TestSqliteEditReply(t *testing.T) { db, err := genTestDB() if err != nil { t.Error(err) @@ -113,7 +113,7 @@ func TestSqliteUpdateReply(t *testing.T) { mr.ID = es0[0].ID mr.Message = "bur" - err = db.UpdateReply(mr) + err = db.EditReply(mr) if err != nil { t.Error(err) } @@ -130,13 +130,8 @@ func TestSqliteDeleteEntry(t *testing.T) { } }() - dc, err := db.DeleteEntry(1) - if err != nil { - t.Error("cannot delete entry", err, dc) - } - - if c, err := db.Count(); err != nil || c != 0 { - t.Error(c, err, dc) + if err = db.DeleteEntry(1); err != nil { + t.Error("cannot delete entry", err) } }