pull/41/head^2
Hunter Long 2018-08-12 06:19:53 -07:00
parent 7db705d43a
commit 17acaf4272
4 changed files with 16 additions and 17 deletions

View File

@ -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:

View File

@ -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

View File

@ -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))

View File

@ -14,8 +14,12 @@ var (
) )
func init() { func init() {
if os.Getenv("STATUP_DIR") != "" {
Directory = os.Getenv("STATUP_DIR")
} else {
Directory = dir() Directory = dir()
} }
}
func StringInt(s string) int64 { func StringInt(s string) int64 {
num, _ := strconv.Atoi(s) num, _ := strconv.Atoi(s)