Modified tests accordingly to all changes.
This commit is contained in:
parent
2cc91b351c
commit
f5631bf3d0
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user