mirror of https://github.com/statping/statping
tests
parent
7db705d43a
commit
17acaf4272
|
@ -24,6 +24,7 @@ env:
|
||||||
- DB_PASS=
|
- DB_PASS=
|
||||||
- DB_DATABASE=test
|
- DB_DATABASE=test
|
||||||
- GO_ENV=test
|
- GO_ENV=test
|
||||||
|
- STATUP_DIR=$GOPATH/src/github.com/hunterlong/statup
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
|
|
@ -27,6 +27,10 @@ var (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
dir = utils.Directory
|
dir = utils.Directory
|
||||||
|
os.Remove(dir + "/statup.db")
|
||||||
|
//os.Remove(gopath+"/cmd/config.yml")
|
||||||
|
os.RemoveAll(dir + "/cmd/assets")
|
||||||
|
os.RemoveAll(dir + "/logs")
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunInit(t *testing.T) {
|
func RunInit(t *testing.T) {
|
||||||
|
@ -42,8 +46,8 @@ func RunInit(t *testing.T) {
|
||||||
func TestRunAll(t *testing.T) {
|
func TestRunAll(t *testing.T) {
|
||||||
//t.Parallel()
|
//t.Parallel()
|
||||||
|
|
||||||
//databases := []string{"sqlite", "postgres", "mysql"}
|
databases := []string{"sqlite", "postgres", "mysql"}
|
||||||
databases := []string{"sqlite"}
|
//databases := []string{"sqlite"}
|
||||||
|
|
||||||
for _, dbt := range databases {
|
for _, dbt := range databases {
|
||||||
|
|
||||||
|
@ -195,9 +199,9 @@ func TestAssetsCommand(t *testing.T) {
|
||||||
c.Run()
|
c.Run()
|
||||||
t.Log(c.Stdout())
|
t.Log(c.Stdout())
|
||||||
t.Log("Directory for Assets: ", dir)
|
t.Log("Directory for Assets: ", dir)
|
||||||
assert.True(t, fileExists("../assets/robots.txt"))
|
assert.FileExists(t, dir+"/cmd/assets/robots.txt")
|
||||||
assert.True(t, fileExists("../assets/js/main.js"))
|
assert.FileExists(t, dir+"/cmd/assets/js/main.js")
|
||||||
assert.True(t, fileExists("../assets/scss/base.scss"))
|
assert.FileExists(t, dir+"/cmd/assets/scss/base.scss")
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunMakeDatabaseConfig(t *testing.T, db string) {
|
func RunMakeDatabaseConfig(t *testing.T, db string) {
|
||||||
|
@ -560,13 +564,6 @@ func RunSettingsHandler(t *testing.T) {
|
||||||
assert.True(t, strings.Contains(rr.Body.String(), "footer"))
|
assert.True(t, strings.Contains(rr.Body.String(), "footer"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func Cleanup(t *testing.T) {
|
|
||||||
os.Remove(dir + "/statup.db")
|
|
||||||
//os.Remove(gopath+"/cmd/config.yml")
|
|
||||||
os.RemoveAll(dir + "/assets")
|
|
||||||
os.RemoveAll(dir + "/logs")
|
|
||||||
}
|
|
||||||
|
|
||||||
func fileExists(file string) bool {
|
func fileExists(file string) bool {
|
||||||
if _, err := os.Stat(file); os.IsNotExist(err) {
|
if _, err := os.Stat(file); os.IsNotExist(err) {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -15,16 +15,13 @@ func init() {
|
||||||
dir = utils.Directory
|
dir = utils.Directory
|
||||||
utils.InitLogs()
|
utils.InitLogs()
|
||||||
Assets()
|
Assets()
|
||||||
|
os.RemoveAll(dir + "/cmd/assets")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCore_UsingAssets(t *testing.T) {
|
func TestCore_UsingAssets(t *testing.T) {
|
||||||
assert.False(t, UsingAssets)
|
assert.False(t, UsingAssets)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHasAssets(t *testing.T) {
|
|
||||||
assert.False(t, HasAssets(dir))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCreateAssets(t *testing.T) {
|
func TestCreateAssets(t *testing.T) {
|
||||||
assert.Nil(t, CreateAllAssets(dir))
|
assert.Nil(t, CreateAllAssets(dir))
|
||||||
assert.True(t, HasAssets(dir))
|
assert.True(t, HasAssets(dir))
|
||||||
|
|
|
@ -14,7 +14,11 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Directory = dir()
|
if os.Getenv("STATUP_DIR") != "" {
|
||||||
|
Directory = os.Getenv("STATUP_DIR")
|
||||||
|
} else {
|
||||||
|
Directory = dir()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func StringInt(s string) int64 {
|
func StringInt(s string) int64 {
|
||||||
|
|
Loading…
Reference in New Issue