From 77e01f8e7cfa2333894c7914016aa73c1a496943 Mon Sep 17 00:00:00 2001 From: Deluan Date: Thu, 25 Feb 2016 11:14:16 -0500 Subject: [PATCH] Fixed packages in tests --- tests/controllers/get_license_test.go | 2 +- tests/controllers/get_music_folders_test.go | 2 +- tests/controllers/ping_test.go | 2 +- tests/controllers/validation_test.go | 6 +++--- tests/test_helper.go | 8 +++++++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/controllers/get_license_test.go b/tests/controllers/get_license_test.go index e77fb1974..a73b99bc6 100644 --- a/tests/controllers/get_license_test.go +++ b/tests/controllers/get_license_test.go @@ -1,4 +1,4 @@ -package test +package controller_test import ( "testing" diff --git a/tests/controllers/get_music_folders_test.go b/tests/controllers/get_music_folders_test.go index 630d7248d..ceb47e3af 100644 --- a/tests/controllers/get_music_folders_test.go +++ b/tests/controllers/get_music_folders_test.go @@ -1,4 +1,4 @@ -package test +package controller_test import ( "testing" diff --git a/tests/controllers/ping_test.go b/tests/controllers/ping_test.go index d8c0e3820..c0dee0c8c 100644 --- a/tests/controllers/ping_test.go +++ b/tests/controllers/ping_test.go @@ -1,4 +1,4 @@ -package test +package controller_test import ( "testing" diff --git a/tests/controllers/validation_test.go b/tests/controllers/validation_test.go index 87ab4fddf..d6b2667ac 100644 --- a/tests/controllers/validation_test.go +++ b/tests/controllers/validation_test.go @@ -1,4 +1,4 @@ -package test +package controller_test import ( "testing" @@ -12,7 +12,7 @@ import ( func TestCheckParams(t *testing.T) { _, w := Get("/rest/ping.view", "TestCheckParams") - Convey("Subject: Validation\n", t, func() { + Convey("Subject: CheckParams\n", t, func() { Convey("Status code should be 200", func() { So(w.Code, ShouldEqual, 200) }) @@ -30,7 +30,7 @@ func TestCheckParams(t *testing.T) { func TestAuthentication(t *testing.T) { _, w := Get("/rest/ping.view?u=INVALID&p=INVALID&c=test&v=1.0.0", "TestAuthentication") - Convey("Subject: Validation\n", t, func() { + Convey("Subject: Authentication\n", t, func() { Convey("Status code should be 200", func() { So(w.Code, ShouldEqual, 200) }) diff --git a/tests/test_helper.go b/tests/test_helper.go index d1f76e9eb..3db059c8d 100644 --- a/tests/test_helper.go +++ b/tests/test_helper.go @@ -7,6 +7,7 @@ import ( "net/http" "path/filepath" "runtime" + "os" ) const ( @@ -20,6 +21,11 @@ func init() { _, file, _, _ := runtime.Caller(1) appPath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator)))) beego.TestBeegoInit(appPath) + + noLog := os.Getenv("NOLOG") + if noLog != "" { + beego.SetLevel(beego.LevelError) + } } func AddParams(url string) string { @@ -31,7 +37,7 @@ func Get(url string, testCase string) (*http.Request, *httptest.ResponseRecorder w := httptest.NewRecorder() beego.BeeApp.Handlers.ServeHTTP(w, r) - beego.Trace("testing", testCase, fmt.Sprintf("\nUrl: %s\nStatus Code: [%d]\n%s", r.URL, w.Code, w.Body.String())) + beego.Debug("testing", testCase, fmt.Sprintf("\nUrl: %s\nStatus Code: [%d]\n%s", r.URL, w.Code, w.Body.String())) return r, w }