Refactor database models into separate package.

This commit is contained in:
Patrick Fairbank
2017-08-23 22:41:56 -07:00
parent 299c601e8f
commit e26781b7d3
76 changed files with 684 additions and 1144 deletions

25
model/database_test.go Normal file
View File

@@ -0,0 +1,25 @@
// Copyright 2014 Team 254. All Rights Reserved.
// Author: pat@patfairbank.com (Patrick Fairbank)
package model
import (
"github.com/stretchr/testify/assert"
"os"
"path/filepath"
"testing"
)
const testDbPath = "test.db"
func TestOpenUnreachableDatabase(t *testing.T) {
_, err := OpenDatabase("..", "nonexistentdir/test.db")
assert.NotNil(t, err)
}
func setupTestDb(t *testing.T) *Database {
os.Remove(filepath.Join("..", testDbPath))
db, err := OpenDatabase("..", testDbPath)
assert.Nil(t, err)
return db
}