Ensure testing credentials are labeled as such

This commit is contained in:
Tim Allclair
2020-02-04 10:36:05 -08:00
parent 4b29407945
commit 9d3670f358
32 changed files with 57 additions and 28 deletions

View File

@@ -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",