update unit testing.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		
							parent
							
								
									eb32e593c8
								
							
						
					
					
						commit
						731d884837
					
				|  | @ -29,4 +29,4 @@ config.yaml | |||
| bin/* | ||||
| .DS_Store | ||||
| coverage.out | ||||
| logs/* | ||||
| gopush/log/*.log | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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.
 | ||||
|  |  | |||
|  | @ -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()) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue