From f956d2dd44f5acf5a77a28760d859faab13b86be Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Thu, 4 Apr 2019 19:57:06 +0200 Subject: [PATCH] remove menial test --- container/trust_test.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/container/trust_test.go b/container/trust_test.go index fc96971..481ce64 100644 --- a/container/trust_test.go +++ b/container/trust_test.go @@ -7,10 +7,6 @@ import ( "github.com/stretchr/testify/assert" ) -func Test_ShouldWork(t *testing.T) { - assert.True(t, true) -} - func TestEncodedEnvAuth_ShouldReturnAnErrorIfRepoEnvsAreUnset(t *testing.T) { os.Unsetenv("REPO_USER") os.Unsetenv("REPO_PASS") @@ -33,17 +29,32 @@ func TestEncodedConfigAuth_ShouldReturnAnErrorIfFileIsNotPresent(t *testing.T) { assert.Error(t, err) } +/* + * TODO: + * This part only confirms that it still works in the same way as it did + * with the old version of the docker api client sdk. I'd say that + * ParseServerAddress likely needs to be elaborated a bit to default to + * dockerhub in case no server address was provided. + * + * ++ @simskij, 2019-04-04 + */ + func TestParseServerAddress_ShouldReturnErrorIfPassedEmptyString(t *testing.T) { _, err := ParseServerAddress("") assert.Error(t, err) } +func TestParseServerAddress_ShouldReturnTheRepoNameIfPassedAFullyQualifiedImageName(t *testing.T) { + val, _ := ParseServerAddress("github.com/containrrrr/config") + assert.Equal(t, val, "github.com") +} + func TestParseServerAddress_ShouldReturnTheOrganizationPartIfPassedAnImageNameMissingServerName(t *testing.T) { val, _ := ParseServerAddress("containrrr/config") assert.Equal(t, val, "containrrr") } -func TestParseServerAddress_ShouldReturnTheRepoNameIfPassedAnImageNameWithoutServerName(t *testing.T) { +func TestParseServerAddress_ShouldReturnTheServerNameIfPassedAFullyQualifiedImageName(t *testing.T) { val, _ := ParseServerAddress("github.com/containrrrr/config") assert.Equal(t, val, "github.com") }