[fix] test data
This commit is contained in:
parent
688c2950eb
commit
71611af1a5
1 changed files with 30 additions and 0 deletions
|
|
@ -88,4 +88,34 @@ func load(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
q.Load(config.Conf)
|
q.Load(config.Conf)
|
||||||
|
clear(t)
|
||||||
|
testData(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testData(t *testing.T) {
|
||||||
|
pet := gou.Select("pet")
|
||||||
|
err := pet.Insert(
|
||||||
|
[]string{"name", "type", "status", "mode", "stay", "cost", "doctor_id"},
|
||||||
|
[][]interface{}{
|
||||||
|
{"Cookie", "cat", "checked", "enabled", 200, 105, 1},
|
||||||
|
{"Baby", "dog", "checked", "enabled", 186, 24, 1},
|
||||||
|
{"Poo", "others", "checked", "enabled", 199, 66, 1},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func clear(t *testing.T) {
|
||||||
|
for _, m := range gou.Models {
|
||||||
|
err := m.DropTable()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
err = m.Migrate(true)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue