forked from goodwithtech/deckoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken_test.go
More file actions
50 lines (47 loc) · 954 Bytes
/
token_test.go
File metadata and controls
50 lines (47 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package image
import (
"context"
"testing"
imageTypes "github.com/containers/image/v5/types"
"github.com/SpazioDati/deckoder/types"
"github.com/stretchr/testify/assert"
)
func TestGetToken(t *testing.T) {
type args struct {
domain string
opt types.DockerOption
}
tests := []struct {
name string
args args
wantAuth *imageTypes.DockerAuthConfig
}{
//{
// name: "happy path",
// args: args{
// domain: "docker.io",
// },
// wantAuth: nil,
//},
{
name: "happy path with a credential",
args: args{
domain: "docker.io",
opt: types.DockerOption{
UserName: "user",
Password: "pass",
},
},
wantAuth: &imageTypes.DockerAuthConfig{
Username: "user",
Password: "pass",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotAuth := GetToken(context.Background(), tt.args.domain, tt.args.opt)
assert.Equal(t, tt.wantAuth, gotAuth)
})
}
}