Move all test data under ./data dir
This commit is contained in:
parent
cc983f9ad6
commit
14cc8d5c24
@ -10,17 +10,17 @@ func Test_Invalid_Bookmark_Files(t *testing.T) {
|
|||||||
_, err := readServerConfig("foobar")
|
_, err := readServerConfig("foobar")
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
_, err = readServerConfig("./fixtures/invalid.toml")
|
_, err = readServerConfig("./data/invalid.toml")
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
assert.Equal(t, "Near line 1, key 'invalid encoding': Near line 2: Expected key separator '=', but got '\\n' instead.", err.Error())
|
assert.Equal(t, "Near line 1, key 'invalid encoding': Near line 2: Expected key separator '=', but got '\\n' instead.", err.Error())
|
||||||
|
|
||||||
_, err = readServerConfig("./fixtures/invalid_port.toml")
|
_, err = readServerConfig("./data/invalid_port.toml")
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
assert.Equal(t, "Type mismatch for 'main.Bookmark.Port': Expected string but found 'int64'.", err.Error())
|
assert.Equal(t, "Type mismatch for 'main.Bookmark.Port': Expected string but found 'int64'.", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_Bookmark(t *testing.T) {
|
func Test_Bookmark(t *testing.T) {
|
||||||
bookmark, err := readServerConfig("./fixtures/bookmark.toml")
|
bookmark, err := readServerConfig("./data/bookmark.toml")
|
||||||
|
|
||||||
assert.Equal(t, nil, err)
|
assert.Equal(t, nil, err)
|
||||||
assert.Equal(t, "localhost", bookmark.Host)
|
assert.Equal(t, "localhost", bookmark.Host)
|
||||||
@ -33,7 +33,7 @@ func Test_Bookmark(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test_Bookmark_URL(t *testing.T) {
|
func Test_Bookmark_URL(t *testing.T) {
|
||||||
bookmark, err := readServerConfig("./fixtures/bookmark_url.toml")
|
bookmark, err := readServerConfig("./data/bookmark_url.toml")
|
||||||
|
|
||||||
assert.Equal(t, nil, err)
|
assert.Equal(t, nil, err)
|
||||||
assert.Equal(t, "postgres://username:password@host:port/database?sslmode=disable", bookmark.Url)
|
assert.Equal(t, "postgres://username:password@host:port/database?sslmode=disable", bookmark.Url)
|
||||||
@ -64,7 +64,7 @@ func Test_ReadBookmarks_Invalid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test_ReadBookmarks(t *testing.T) {
|
func Test_ReadBookmarks(t *testing.T) {
|
||||||
bookmarks, err := readAllBookmarks("./fixtures")
|
bookmarks, err := readAllBookmarks("./data")
|
||||||
|
|
||||||
assert.Equal(t, nil, err)
|
assert.Equal(t, nil, err)
|
||||||
assert.Equal(t, 2, len(bookmarks))
|
assert.Equal(t, 2, len(bookmarks))
|
||||||
|
@ -40,7 +40,7 @@ func setup() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err = exec.Command(testCommands["psql"], "-U", "postgres", "-h", "localhost", "-f", "./sql/booktown.sql", "booktown").CombinedOutput()
|
out, err = exec.Command(testCommands["psql"], "-U", "postgres", "-h", "localhost", "-f", "./data/booktown.sql", "booktown").CombinedOutput()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Database import failed:", string(out))
|
fmt.Println("Database import failed:", string(out))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user