@@ -60,17 +60,25 @@ func TestOSXKeychainHelper(t *testing.T) {
60
60
// through variations on the URL
61
61
func TestOSXKeychainHelperRetrieveAliases (t * testing.T ) {
62
62
tests := []struct {
63
+ doc string
63
64
storeURL string
64
65
readURL string
65
66
}{
66
- // stored with port, retrieved without
67
- {"https://foobar.docker.io:2376" , "https://foobar.docker.io" },
68
-
69
- // stored as https, retrieved without scheme
70
- {"https://foobar.docker.io:2376" , "foobar.docker.io" },
71
-
72
- // stored with path, retrieved without
73
- {"https://foobar.docker.io:1234/one/two" , "https://foobar.docker.io:1234" },
67
+ {
68
+ doc : "stored with port, retrieved without" ,
69
+ storeURL : "https://foobar.docker.io:2376" ,
70
+ readURL : "https://foobar.docker.io" ,
71
+ },
72
+ {
73
+ doc : "stored as https, retrieved without scheme" ,
74
+ storeURL : "https://foobar.docker.io:2376" ,
75
+ readURL : "foobar.docker.io" ,
76
+ },
77
+ {
78
+ doc : "stored with path, retrieved without" ,
79
+ storeURL : "https://foobar.docker.io:1234/one/two" ,
80
+ readURL : "https://foobar.docker.io:1234" ,
81
+ },
74
82
}
75
83
76
84
helper := Osxkeychain {}
@@ -102,26 +110,42 @@ func TestOSXKeychainHelperRetrieveAliases(t *testing.T) {
102
110
// returned.
103
111
func TestOSXKeychainHelperRetrieveStrict (t * testing.T ) {
104
112
tests := []struct {
113
+ doc string
105
114
storeURL string
106
115
readURL string
107
116
}{
108
- // stored as https, retrieved using http
109
- {"https://foobar.docker.io:2376" , "http://foobar.docker.io:2376" },
110
-
111
- // stored as http, retrieved using https
112
- {"http://foobar.docker.io:2376" , "https://foobar.docker.io:2376" },
113
-
114
- // same: stored as http, retrieved without a scheme specified (hence, using the default https://)
115
- {"http://foobar.docker.io" , "foobar.docker.io:5678" },
116
-
117
- // non-matching ports
118
- {"https://foobar.docker.io:1234" , "https://foobar.docker.io:5678" },
119
-
120
- // non-matching ports TODO is this desired behavior? The other way round does work
121
- // {"https://foobar.docker.io", "https://foobar.docker.io:5678"},
122
-
123
- // non-matching paths
124
- {"https://foobar.docker.io:1234/one/two" , "https://foobar.docker.io:1234/five/six" },
117
+ {
118
+ doc : "stored as https, retrieved using http" ,
119
+ storeURL : "https://foobar.docker.io:2376" ,
120
+ readURL : "http://foobar.docker.io:2376" ,
121
+ },
122
+ {
123
+ doc : "stored as http, retrieved using https" ,
124
+ storeURL : "http://foobar.docker.io:2376" ,
125
+ readURL : "https://foobar.docker.io:2376" ,
126
+ },
127
+ {
128
+ // stored as http, retrieved without a scheme specified (hence, using the default https://)
129
+ doc : "stored as http, retrieved without scheme" ,
130
+ storeURL : "http://foobar.docker.io" ,
131
+ readURL : "foobar.docker.io:5678" ,
132
+ },
133
+ {
134
+ doc : "non-matching ports" ,
135
+ storeURL : "https://foobar.docker.io:1234" ,
136
+ readURL : "https://foobar.docker.io:5678" ,
137
+ },
138
+ // TODO: is this desired behavior? The other way round does work
139
+ // {
140
+ // doc: "non-matching ports (stored without port)",
141
+ // storeURL: "https://foobar.docker.io",
142
+ // readURL: "https://foobar.docker.io:5678",
143
+ // },
144
+ {
145
+ doc : "non-matching paths" ,
146
+ storeURL : "https://foobar.docker.io:1234/one/two" ,
147
+ readURL : "https://foobar.docker.io:1234/five/six" ,
148
+ },
125
149
}
126
150
127
151
helper := Osxkeychain {}
0 commit comments