update unit testing.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-04-07 14:42:38 +08:00
parent eb32e593c8
commit 731d884837
5 changed files with 6 additions and 4 deletions

2
.gitignore vendored
View File

@ -29,4 +29,4 @@ config.yaml
bin/*
.DS_Store
coverage.out
logs/*
gopush/log/*.log

View File

@ -21,7 +21,6 @@ var (
)
type LogReq struct {
Time string `json:"time"`
URI string `json:"uri"`
Method string `json:"method"`
IP string `json:"ip"`
@ -98,7 +97,7 @@ func SetLogLevel(log *logrus.Logger, levelString string) error {
return nil
}
func LogRequest(uri, method, ip string, contentType string, agent string) {
func LogRequest(uri string, method string, ip string, contentType string, agent string) {
var output string
log := &LogReq{
URI: uri,

0
gorush/log/.gitkeep Normal file
View File

View File

@ -25,7 +25,7 @@ func TestSetLogOut(t *testing.T) {
err = SetLogOut(log, "stderr")
assert.Nil(t, err)
err = SetLogOut(log, "access.log")
err = SetLogOut(log, "log/access.log")
assert.Nil(t, err)
// missing create logs folder.

View File

@ -62,6 +62,9 @@ func TestRootHandler(t *testing.T) {
r := gofight.New()
// log for json
PushConf.Log.Format = "json"
r.GET("/").
Run(GetMainEngine(), func(r gofight.HTTPResponse, rq gofight.HTTPRequest) {
data := []byte(r.Body.String())