7 . "github.com/onsi/gomega"
10func TestMakeAuhtorizationHeader(t *testing.T) {
11 testCases := []struct {
15 extraHeaders map[string]string
18 name: "With an empty prefix, token and no additional headers",
24 name: "With a Bearer token type",
25 prefix: tokenTypeBearer,
30 name: "With a Token token type",
31 prefix: tokenTypeToken,
36 name: "With a Bearer token type and Accept application/json",
37 prefix: tokenTypeToken,
39 extraHeaders: map[string]string{
40 acceptHeader: acceptApplicationJSON,
44 name: "With a Bearer token type and multiple headers",
45 prefix: tokenTypeToken,
47 extraHeaders: map[string]string{
48 acceptHeader: acceptApplicationJSON,
55 for _, tc := range testCases {
56 t.Run(tc.name, func(t *testing.T) {
59 header := makeAuthorizationHeader(tc.prefix, tc.token, tc.extraHeaders)
60 g.Expect(header.Get("Authorization")).To(Equal(fmt.Sprintf("%s %s", tc.prefix, tc.token)))
61 for k, v := range tc.extraHeaders {
62 g.Expect(header.Get(k)).To(Equal(v))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list