github.com/artisanhe/tools@v1.0.1-0.20210607022958-19a8fef2eb04/authorization/authorization_test.go (about) 1 package authorization 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestAuthorizations(t *testing.T) { 10 tt := assert.New(t) 11 12 auths := Authorizations{} 13 14 auths.Add("Bearer", "xxxxx") 15 auths.Add("WechatBearer", "yyyyy") 16 17 t.Log(auths.String()) 18 19 tt.Equal(auths, ParseAuthorization(auths.String())) 20 tt.Equal("xxxxx", auths.Get("bearer")) 21 tt.Equal("yyyyy", auths.Get("WechatBearer")) 22 }