Skip to content
Permalink
Browse files

fix: improve coverage

  • Loading branch information...
appleboy committed Aug 19, 2019
1 parent 59c6ef6 commit dac4796c24ed0f0ef89bd3929cf2aac16901a896
Showing with 12 additions and 3 deletions.
  1. +1 −1 go.mod
  2. +2 −2 go.sum
  3. +9 −0 prom_test.go
2 go.mod
@@ -1,7 +1,7 @@
module github.com/Depado/ginprom

require (
github.com/appleboy/gofight/v2 v2.0.0+incompatible
github.com/appleboy/gofight/v2 v2.1.1
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gin-gonic/gin v1.4.0
4 go.sum
@@ -1,6 +1,6 @@
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/appleboy/gofight/v2 v2.0.0+incompatible h1:mfTmEhmo9BZnzAtFpRL8MEkAxuWEzfJ3Gpgn6Zuzgw4=
github.com/appleboy/gofight/v2 v2.0.0+incompatible/go.mod h1:6E7pthKhmwss84j/zEixBNim8Q6ahhHcYOtmW5ts5vA=
github.com/appleboy/gofight/v2 v2.1.1 h1:mBiMmXAofKf1GdEHxp8QkfrRaj/nBCoDnkwjn8axsq8=
github.com/appleboy/gofight/v2 v2.1.1/go.mod h1:6E7pthKhmwss84j/zEixBNim8Q6ahhHcYOtmW5ts5vA=
github.com/astaxie/beego v1.11.1/go.mod h1:i69hVzgauOPSw5qeyF4GVZhn7Od0yG5bbCGzmhbWxgQ=
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
@@ -246,6 +246,15 @@ func TestMetricsBearerToken(t *testing.T) {
assert.Equal(t, errInvalidToken.Error(), r.Body.String())
})

g.GET(p.MetricsPath).
SetHeader(gofight.H{
"Authorization": "Bearer " + "test-1234-5678",
}).
Run(r, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) {
assert.Equal(t, http.StatusUnauthorized, r.Code)
assert.Equal(t, errInvalidToken.Error(), r.Body.String())
})

g.GET(p.MetricsPath).
SetHeader(gofight.H{
"Authorization": "Bearer " + "test-1234",

0 comments on commit dac4796

Please sign in to comment.
You can’t perform that action at this time.