mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-08 14:29:45 +00:00
Ensure testing credentials are labeled as such
This commit is contained in:
@@ -63,6 +63,7 @@ func TestReadDockerConfigFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
func TestDockerConfigJsonJSONDecode(t *testing.T) {
|
||||
// Fake values for testing.
|
||||
input := []byte(`{"auths": {"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}}`)
|
||||
|
||||
expect := DockerConfigJson{
|
||||
@@ -92,6 +93,7 @@ func TestDockerConfigJsonJSONDecode(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDockerConfigJSONDecode(t *testing.T) {
|
||||
// Fake values for testing.
|
||||
input := []byte(`{"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}`)
|
||||
|
||||
expect := DockerConfig(map[string]DockerConfigEntry{
|
||||
@@ -126,6 +128,7 @@ func TestDockerConfigEntryJSONDecode(t *testing.T) {
|
||||
}{
|
||||
// simple case, just decode the fields
|
||||
{
|
||||
// Fake values for testing.
|
||||
input: []byte(`{"username": "foo", "password": "bar", "email": "foo@example.com"}`),
|
||||
expect: DockerConfigEntry{
|
||||
Username: "foo",
|
||||
@@ -148,6 +151,7 @@ func TestDockerConfigEntryJSONDecode(t *testing.T) {
|
||||
|
||||
// auth field overrides username & password
|
||||
{
|
||||
// Fake values for testing.
|
||||
input: []byte(`{"username": "foo", "password": "bar", "auth": "cGluZzpwb25n", "email": "foo@example.com"}`),
|
||||
expect: DockerConfigEntry{
|
||||
Username: "ping",
|
||||
@@ -284,6 +288,7 @@ func TestDockerConfigEntryJSONCompatibleEncode(t *testing.T) {
|
||||
}{
|
||||
// simple case, just decode the fields
|
||||
{
|
||||
// Fake values for testing.
|
||||
expect: []byte(`{"username":"foo","password":"bar","email":"foo@example.com","auth":"Zm9vOmJhcg=="}`),
|
||||
input: DockerConfigEntry{
|
||||
Username: "foo",
|
||||
|
Reference in New Issue
Block a user