[WIP] migration to psql
TODO: [ ] stats [ ] indexes
This commit is contained in:
parent
e1bd235785
commit
e72de38725
24 changed files with 648 additions and 936 deletions
|
@ -5,8 +5,8 @@ import "testing"
|
|||
func TestNews(t *testing.T) {
|
||||
const text = "Some news text"
|
||||
|
||||
db := Init(test_host, test_coll)
|
||||
defer del(db)
|
||||
db, dbclose := testDbInit(t)
|
||||
defer dbclose()
|
||||
|
||||
err := db.AddNews(text)
|
||||
if err != nil {
|
||||
|
@ -24,3 +24,29 @@ func TestNews(t *testing.T) {
|
|||
t.Errorf("News text don't match : '", news[0].Text, "' <=> '", text, "'")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTwoNews(t *testing.T) {
|
||||
const text = "Some news text"
|
||||
const text2 = "More news"
|
||||
|
||||
db, dbclose := testDbInit(t)
|
||||
defer dbclose()
|
||||
|
||||
err := db.AddNews(text)
|
||||
if err != nil {
|
||||
t.Errorf("db.News(", text, ") return an error: ", err)
|
||||
}
|
||||
|
||||
err = db.AddNews(text2)
|
||||
if err != nil {
|
||||
t.Errorf("db.News(", text, ") return an error: ", err)
|
||||
}
|
||||
|
||||
news, err := db.GetNews(2, 1)
|
||||
if err != nil {
|
||||
t.Fatalf("db.GetNews() return an error: ", err)
|
||||
}
|
||||
if len(news) < 2 {
|
||||
t.Fatalf("No news found.")
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue