generic test config

This commit is contained in:
Jimmy Zelinskie
2013-08-29 00:47:37 -04:00
parent 6e7d6f1a31
commit a2527aa4e2
4 changed files with 14 additions and 20 deletions

View File

@@ -11,21 +11,14 @@ import (
"testing"
)
func getConfigPath() string {
if os.Getenv("TRAVISCONFIGPATH") != "" {
return os.Getenv("TRAVISCONFIGPATH")
}
return os.ExpandEnv("$GOPATH/src/github.com/pushrax/chihaya/config/example.json")
}
func TestOpenConfig(t *testing.T) {
if _, err := Open(getConfigPath()); err != nil {
if _, err := Open(os.Getenv("TESTCONFIGPATH")); err != nil {
t.Error(err)
}
}
func TestNewConfig(t *testing.T) {
contents, err := ioutil.ReadFile(getConfigPath())
contents, err := ioutil.ReadFile(os.Getenv("TESTCONFIGPATH"))
if err != nil {
t.Error(err)
}