tests: move trust test to proper package

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
master
Riyaz Faizullabhoy 2017-09-15 09:33:01 -07:00
parent 4e89dc800a
commit 67cf09cbe1
2 changed files with 16 additions and 11 deletions

View File

@ -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")
}

View File

@ -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")
}