Skip to content

Commit 707d113

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 3b3a67b commit 707d113

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

osxkeychain/osxkeychain_darwin_test.go

Lines changed: 22 additions & 20 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
}
@@ -64,13 +64,13 @@ func TestOSXKeychainHelperRetrieveAliases(t *testing.T) {
6464
readURL string
6565
}{
6666
// stored with port, retrieved without
67-
{"https://foobar.docker.io:2376", "https://foobar.docker.io"},
67+
{"https://foobar.example.com:2376", "https://foobar.example.com"},
6868

6969
// stored as https, retrieved without scheme
70-
{"https://foobar.docker.io:2376", "foobar.docker.io"},
70+
{"https://foobar.example.com:2376", "foobar.example.com"},
7171

7272
// stored with path, retrieved without
73-
{"https://foobar.docker.io:1234/one/two", "https://foobar.docker.io:1234"},
73+
{"https://foobar.example.com:1234/one/two", "https://foobar.example.com:1234"},
7474
}
7575

7676
helper := Osxkeychain{}
@@ -106,22 +106,24 @@ func TestOSXKeychainHelperRetrieveStrict(t *testing.T) {
106106
readURL string
107107
}{
108108
// stored as https, retrieved using http
109-
{"https://foobar.docker.io:2376", "http://foobar.docker.io:2376"},
109+
{"https://foobar.example.com:2376", "http://foobar.example.com:2376"},
110110

111111
// stored as http, retrieved using https
112-
{"http://foobar.docker.io:2376", "https://foobar.docker.io:2376"},
112+
{"http://foobar.example.com:2376", "https://foobar.example.com:2376"},
113113

114114
// same: stored as http, retrieved without a scheme specified (hence, using the default https://)
115-
{"http://foobar.docker.io", "foobar.docker.io:5678"},
115+
{"http://foobar.example.com", "foobar.example.com:5678"},
116116

117117
// non-matching ports
118-
{"https://foobar.docker.io:1234", "https://foobar.docker.io:5678"},
118+
{"https://foobar.example.com:1234", "https://foobar.example.com:5678"},
119119

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"},
120+
// non-matching ports
121+
//
122+
// TODO: is this desired behavior? The other way round does work
123+
// {"https://foobar.example.com", "https://foobar.example.com:5678"},
122124

123125
// non-matching paths
124-
{"https://foobar.docker.io:1234/one/two", "https://foobar.docker.io:1234/five/six"},
126+
{"https://foobar.example.com:1234/one/two", "https://foobar.example.com:1234/five/six"},
125127
}
126128

127129
helper := Osxkeychain{}
@@ -155,14 +157,14 @@ func TestOSXKeychainHelperStoreRetrieve(t *testing.T) {
155157
tests := []struct {
156158
url string
157159
}{
158-
{url: "foobar.docker.io"},
159-
{url: "foobar.docker.io:2376"},
160-
{url: "//foobar.docker.io:2376"},
161-
{url: "https://foobar.docker.io:2376"},
162-
{url: "http://foobar.docker.io:2376"},
163-
{url: "https://foobar.docker.io:2376/some/path"},
164-
{url: "https://foobar.docker.io:2376/some/other/path"},
165-
{url: "https://foobar.docker.io:2376/some/other/path?foo=bar"},
160+
{url: "foobar.example.com"},
161+
{url: "foobar.example.com:2376"},
162+
{url: "//foobar.example.com:2376"},
163+
{url: "https://foobar.example.com:2376"},
164+
{url: "http://foobar.example.com:2376"},
165+
{url: "https://foobar.example.com:2376/some/path"},
166+
{url: "https://foobar.example.com:2376/some/other/path"},
167+
{url: "https://foobar.example.com:2376/some/other/path?foo=bar"},
166168
}
167169

168170
helper := Osxkeychain{}

0 commit comments

Comments
 (0)