git grep -l -P '^\s+assert\.Check\(t, is\.Error\(' | \
xargs perl -pi -e 's/^(\s+assert\.)Check\(t, is\.Error\((.*)\)$/\1Error(t, \2/'
Signed-off-by: Daniel Nephin <dnephin@docker.com>
25 lines
707 B
Go
25 lines
707 B
Go
package trust
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/gotestyourself/gotestyourself/assert"
|
|
"github.com/theupdateframework/notary/client"
|
|
"github.com/theupdateframework/notary/passphrase"
|
|
"github.com/theupdateframework/notary/trustpinning"
|
|
)
|
|
|
|
func TestGetOrGenerateNotaryKeyAndInitRepo(t *testing.T) {
|
|
tmpDir, err := ioutil.TempDir("", "notary-test-")
|
|
assert.NilError(t, err)
|
|
defer os.RemoveAll(tmpDir)
|
|
|
|
notaryRepo, err := client.NewFileCachedRepository(tmpDir, "gun", "https://localhost", nil, passphrase.ConstantRetriever(passwd), trustpinning.TrustPinConfig{})
|
|
assert.NilError(t, err)
|
|
|
|
err = getOrGenerateRootKeyAndInitRepo(notaryRepo)
|
|
assert.Error(t, err, "client is offline")
|
|
}
|