Exemplo n.º 1
0
func TestCreateTestDatabaseWorksWithValidEntry(t *testing.T) {
	db, err := database.CreateTestDatabase("", nil, nil)
	assert.Nil(t, err)
	assert.NotNil(t, db)
	err = db.Close()
	assert.Nil(t, err)
}
Exemplo n.º 2
0
func TestCreateTestDatabaseFailsWithMissingFixtureFile(t *testing.T) {
	badFixtures := []string{"/badfilename"}
	db, err := database.CreateTestDatabase("", nil, badFixtures)
	assert.EqualError(t, err, "Error loading file /badfilename: open /badfilename: no such file or directory")
	assert.Nil(t, db)
}
Exemplo n.º 3
0
func TestCreateTestDatabaseFailsWithBadValues(t *testing.T) {
	db, err := database.CreateTestDatabase("!_@£@$@!±/\\", nil, nil)
	assert.Error(t, err)
	assert.Nil(t, db)
}