Skip to content

Commit b5ae3f3

Browse files
committed
osxkeychain: use designated domains in tests (RFC2606)
Update domains used in tests to used domains that are designated for this purpose as described in [RFC2606, section 3][1] [1]: https://www.rfc-editor.org/rfc/rfc2606.html#section-3 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 2380453 commit b5ae3f3

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

osxkeychain/osxkeychain_darwin_test.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99

1010
func TestOSXKeychainHelper(t *testing.T) {
1111
creds := &credentials.Credentials{
12-
ServerURL: "https://foobar.docker.io:2376/v1",
12+
ServerURL: "https://foobar.example.com:2376/v1",
1313
Username: "foobar",
1414
Secret: "foobarbaz",
1515
}
1616
creds1 := &credentials.Credentials{
17-
ServerURL: "https://foobar.docker.io:2376/v2",
17+
ServerURL: "https://foobar.example.com:2376/v2",
1818
Username: "foobarbaz",
1919
Secret: "foobar",
2020
}
@@ -66,18 +66,18 @@ func TestOSXKeychainHelperRetrieveAliases(t *testing.T) {
6666
}{
6767
{
6868
doc: "stored with port, retrieved without",
69-
storeURL: "https://foobar.docker.io:2376",
70-
readURL: "https://foobar.docker.io",
69+
storeURL: "https://foobar.example.com:2376",
70+
readURL: "https://foobar.example.com",
7171
},
7272
{
7373
doc: "stored as https, retrieved without scheme",
74-
storeURL: "https://foobar.docker.io:2376",
75-
readURL: "foobar.docker.io",
74+
storeURL: "https://foobar.example.com:2376",
75+
readURL: "foobar.example.com",
7676
},
7777
{
7878
doc: "stored with path, retrieved without",
79-
storeURL: "https://foobar.docker.io:1234/one/two",
80-
readURL: "https://foobar.docker.io:1234",
79+
storeURL: "https://foobar.example.com:1234/one/two",
80+
readURL: "https://foobar.example.com:1234",
8181
},
8282
}
8383

@@ -124,35 +124,35 @@ func TestOSXKeychainHelperRetrieveStrict(t *testing.T) {
124124
}{
125125
{
126126
doc: "stored as https, retrieved using http",
127-
storeURL: "https://foobar.docker.io:2376",
128-
readURL: "http://foobar.docker.io:2376",
127+
storeURL: "https://foobar.example.com:2376",
128+
readURL: "http://foobar.example.com:2376",
129129
},
130130
{
131131
doc: "stored as http, retrieved using https",
132-
storeURL: "http://foobar.docker.io:2376",
133-
readURL: "https://foobar.docker.io:2376",
132+
storeURL: "http://foobar.example.com:2376",
133+
readURL: "https://foobar.example.com:2376",
134134
},
135135
{
136136
// stored as http, retrieved without a scheme specified (hence, using the default https://)
137137
doc: "stored as http, retrieved without scheme",
138-
storeURL: "http://foobar.docker.io",
139-
readURL: "foobar.docker.io:5678",
138+
storeURL: "http://foobar.example.com",
139+
readURL: "foobar.example.com:5678",
140140
},
141141
{
142142
doc: "non-matching ports",
143-
storeURL: "https://foobar.docker.io:1234",
144-
readURL: "https://foobar.docker.io:5678",
143+
storeURL: "https://foobar.example.com:1234",
144+
readURL: "https://foobar.example.com:5678",
145145
},
146146
// TODO: is this desired behavior? The other way round does work
147147
// {
148148
// doc: "non-matching ports (stored without port)",
149-
// storeURL: "https://foobar.docker.io",
150-
// readURL: "https://foobar.docker.io:5678",
149+
// storeURL: "https://foobar.example.com",
150+
// readURL: "https://foobar.example.com:5678",
151151
// },
152152
{
153153
doc: "non-matching paths",
154-
storeURL: "https://foobar.docker.io:1234/one/two",
155-
readURL: "https://foobar.docker.io:1234/five/six",
154+
storeURL: "https://foobar.example.com:1234/one/two",
155+
readURL: "https://foobar.example.com:1234/five/six",
156156
},
157157
}
158158

@@ -195,14 +195,14 @@ func TestOSXKeychainHelperStoreRetrieve(t *testing.T) {
195195
tests := []struct {
196196
url string
197197
}{
198-
{url: "foobar.docker.io"},
199-
{url: "foobar.docker.io:2376"},
200-
{url: "//foobar.docker.io:2376"},
201-
{url: "https://foobar.docker.io:2376"},
202-
{url: "http://foobar.docker.io:2376"},
203-
{url: "https://foobar.docker.io:2376/some/path"},
204-
{url: "https://foobar.docker.io:2376/some/other/path"},
205-
{url: "https://foobar.docker.io:2376/some/other/path?foo=bar"},
198+
{url: "foobar.example.com"},
199+
{url: "foobar.example.com:2376"},
200+
{url: "//foobar.example.com:2376"},
201+
{url: "https://foobar.example.com:2376"},
202+
{url: "http://foobar.example.com:2376"},
203+
{url: "https://foobar.example.com:2376/some/path"},
204+
{url: "https://foobar.example.com:2376/some/other/path"},
205+
{url: "https://foobar.example.com:2376/some/other/path?foo=bar"},
206206
}
207207

208208
helper := Osxkeychain{}

0 commit comments

Comments
 (0)