Skip to content

Commit 20511e6

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 ab3ff93 commit 20511e6

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

osxkeychain/osxkeychain_test.go

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

1212
func TestOSXKeychainHelper(t *testing.T) {
1313
creds := &credentials.Credentials{
14-
ServerURL: "https://foobar.docker.io:2376/v1",
14+
ServerURL: "https://foobar.example.com:2376/v1",
1515
Username: "foobar",
1616
Secret: "foobarbaz",
1717
}
1818
creds1 := &credentials.Credentials{
19-
ServerURL: "https://foobar.docker.io:2376/v2",
19+
ServerURL: "https://foobar.example.com:2376/v2",
2020
Username: "foobarbaz",
2121
Secret: "foobar",
2222
}
@@ -68,18 +68,18 @@ func TestOSXKeychainHelperRetrieveAliases(t *testing.T) {
6868
}{
6969
{
7070
doc: "stored with port, retrieved without",
71-
storeURL: "https://foobar.docker.io:2376",
72-
readURL: "https://foobar.docker.io",
71+
storeURL: "https://foobar.example.com:2376",
72+
readURL: "https://foobar.example.com",
7373
},
7474
{
7575
doc: "stored as https, retrieved without scheme",
76-
storeURL: "https://foobar.docker.io:2376",
77-
readURL: "foobar.docker.io",
76+
storeURL: "https://foobar.example.com:2376",
77+
readURL: "foobar.example.com",
7878
},
7979
{
8080
doc: "stored with path, retrieved without",
81-
storeURL: "https://foobar.docker.io:1234/one/two",
82-
readURL: "https://foobar.docker.io:1234",
81+
storeURL: "https://foobar.example.com:1234/one/two",
82+
readURL: "https://foobar.example.com:1234",
8383
},
8484
}
8585

@@ -126,35 +126,35 @@ func TestOSXKeychainHelperRetrieveStrict(t *testing.T) {
126126
}{
127127
{
128128
doc: "stored as https, retrieved using http",
129-
storeURL: "https://foobar.docker.io:2376",
130-
readURL: "http://foobar.docker.io:2376",
129+
storeURL: "https://foobar.example.com:2376",
130+
readURL: "http://foobar.example.com:2376",
131131
},
132132
{
133133
doc: "stored as http, retrieved using https",
134-
storeURL: "http://foobar.docker.io:2376",
135-
readURL: "https://foobar.docker.io:2376",
134+
storeURL: "http://foobar.example.com:2376",
135+
readURL: "https://foobar.example.com:2376",
136136
},
137137
{
138138
// stored as http, retrieved without a scheme specified (hence, using the default https://)
139139
doc: "stored as http, retrieved without scheme",
140-
storeURL: "http://foobar.docker.io",
141-
readURL: "foobar.docker.io:5678",
140+
storeURL: "http://foobar.example.com",
141+
readURL: "foobar.example.com:5678",
142142
},
143143
{
144144
doc: "non-matching ports",
145-
storeURL: "https://foobar.docker.io:1234",
146-
readURL: "https://foobar.docker.io:5678",
145+
storeURL: "https://foobar.example.com:1234",
146+
readURL: "https://foobar.example.com:5678",
147147
},
148148
// TODO: is this desired behavior? The other way round does work
149149
// {
150150
// doc: "non-matching ports (stored without port)",
151-
// storeURL: "https://foobar.docker.io",
152-
// readURL: "https://foobar.docker.io:5678",
151+
// storeURL: "https://foobar.example.com",
152+
// readURL: "https://foobar.example.com:5678",
153153
// },
154154
{
155155
doc: "non-matching paths",
156-
storeURL: "https://foobar.docker.io:1234/one/two",
157-
readURL: "https://foobar.docker.io:1234/five/six",
156+
storeURL: "https://foobar.example.com:1234/one/two",
157+
readURL: "https://foobar.example.com:1234/five/six",
158158
},
159159
}
160160

@@ -197,14 +197,14 @@ func TestOSXKeychainHelperStoreRetrieve(t *testing.T) {
197197
tests := []struct {
198198
url string
199199
}{
200-
{url: "foobar.docker.io"},
201-
{url: "foobar.docker.io:2376"},
202-
{url: "//foobar.docker.io:2376"},
203-
{url: "https://foobar.docker.io:2376"},
204-
{url: "http://foobar.docker.io:2376"},
205-
{url: "https://foobar.docker.io:2376/some/path"},
206-
{url: "https://foobar.docker.io:2376/some/other/path"},
207-
{url: "https://foobar.docker.io:2376/some/other/path?foo=bar"},
200+
{url: "foobar.example.com"},
201+
{url: "foobar.example.com:2376"},
202+
{url: "//foobar.example.com:2376"},
203+
{url: "https://foobar.example.com:2376"},
204+
{url: "http://foobar.example.com:2376"},
205+
{url: "https://foobar.example.com:2376/some/path"},
206+
{url: "https://foobar.example.com:2376/some/other/path"},
207+
{url: "https://foobar.example.com:2376/some/other/path?foo=bar"},
208208
}
209209

210210
helper := Osxkeychain{}

0 commit comments

Comments
 (0)