From 67cf09cbe1c943990007e2d2e3f96fd2b017eab1 Mon Sep 17 00:00:00 2001 From: Riyaz Faizullabhoy Date: Fri, 15 Sep 2017 09:33:01 -0700 Subject: [PATCH] tests: move trust test to proper package Signed-off-by: Riyaz Faizullabhoy --- cli/command/image/trust_test.go | 11 ----------- cli/trust/trust_test.go | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cli/command/image/trust_test.go b/cli/command/image/trust_test.go index cc79b21b61..d173973d88 100644 --- a/cli/command/image/trust_test.go +++ b/cli/command/image/trust_test.go @@ -71,14 +71,3 @@ func TestAddTargetToAllSignableRolesError(t *testing.T) { err = AddTargetToAllSignableRoles(notaryRepo, &target) assert.EqualError(t, err, "client is offline") } - -func TestGetSignableRolesError(t *testing.T) { - tmpDir, err := ioutil.TempDir("", "notary-test-") - assert.NoError(t, err) - defer os.RemoveAll(tmpDir) - - notaryRepo, err := client.NewFileCachedRepository(tmpDir, "gun", "https://localhost", nil, passphrase.ConstantRetriever("password"), trustpinning.TrustPinConfig{}) - target := client.Target{} - _, err = trust.GetSignableRoles(notaryRepo, &target) - assert.EqualError(t, err, "client is offline") -} diff --git a/cli/trust/trust_test.go b/cli/trust/trust_test.go index 50bcc046fa..5cd339d358 100644 --- a/cli/trust/trust_test.go +++ b/cli/trust/trust_test.go @@ -1,9 +1,14 @@ package trust import ( + "io/ioutil" + "os" "testing" "github.com/docker/distribution/reference" + "github.com/docker/notary/client" + "github.com/docker/notary/passphrase" + "github.com/docker/notary/trustpinning" digest "github.com/opencontainers/go-digest" "github.com/stretchr/testify/assert" ) @@ -41,3 +46,14 @@ func TestGetDigest(t *testing.T) { d = getDigest(ref) assert.Equal(t, digest.Digest(""), d) } + +func TestGetSignableRolesError(t *testing.T) { + tmpDir, err := ioutil.TempDir("", "notary-test-") + assert.NoError(t, err) + defer os.RemoveAll(tmpDir) + + notaryRepo, err := client.NewFileCachedRepository(tmpDir, "gun", "https://localhost", nil, passphrase.ConstantRetriever("password"), trustpinning.TrustPinConfig{}) + target := client.Target{} + _, err = GetSignableRoles(notaryRepo, &target) + assert.EqualError(t, err, "client is offline") +}