mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-14 11:17:19 +03:00
Fixed packages in tests
This commit is contained in:
parent
d3542c48e4
commit
77e01f8e7c
@ -1,4 +1,4 @@
|
|||||||
package test
|
package controller_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package test
|
package controller_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package test
|
package controller_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package test
|
package controller_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -12,7 +12,7 @@ import (
|
|||||||
func TestCheckParams(t *testing.T) {
|
func TestCheckParams(t *testing.T) {
|
||||||
_, w := Get("/rest/ping.view", "TestCheckParams")
|
_, 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() {
|
Convey("Status code should be 200", func() {
|
||||||
So(w.Code, ShouldEqual, 200)
|
So(w.Code, ShouldEqual, 200)
|
||||||
})
|
})
|
||||||
@ -30,7 +30,7 @@ func TestCheckParams(t *testing.T) {
|
|||||||
func TestAuthentication(t *testing.T) {
|
func TestAuthentication(t *testing.T) {
|
||||||
_, w := Get("/rest/ping.view?u=INVALID&p=INVALID&c=test&v=1.0.0", "TestAuthentication")
|
_, 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() {
|
Convey("Status code should be 200", func() {
|
||||||
So(w.Code, ShouldEqual, 200)
|
So(w.Code, ShouldEqual, 200)
|
||||||
})
|
})
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -20,6 +21,11 @@ func init() {
|
|||||||
_, file, _, _ := runtime.Caller(1)
|
_, file, _, _ := runtime.Caller(1)
|
||||||
appPath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
|
appPath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
|
||||||
beego.TestBeegoInit(appPath)
|
beego.TestBeegoInit(appPath)
|
||||||
|
|
||||||
|
noLog := os.Getenv("NOLOG")
|
||||||
|
if noLog != "" {
|
||||||
|
beego.SetLevel(beego.LevelError)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddParams(url string) string {
|
func AddParams(url string) string {
|
||||||
@ -31,7 +37,7 @@ func Get(url string, testCase string) (*http.Request, *httptest.ResponseRecorder
|
|||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
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
|
return r, w
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user