2017-09-26 20:16:18 -04:00
|
|
|
package trust
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2017-10-30 12:21:41 -04:00
|
|
|
"github.com/theupdateframework/notary/client"
|
|
|
|
"github.com/theupdateframework/notary/passphrase"
|
|
|
|
"github.com/theupdateframework/notary/trustpinning"
|
2020-02-22 12:12:14 -05:00
|
|
|
"gotest.tools/v3/assert"
|
2017-09-26 20:16:18 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetOrGenerateNotaryKeyAndInitRepo(t *testing.T) {
|
2022-02-25 08:33:57 -05:00
|
|
|
notaryRepo, err := client.NewFileCachedRepository(t.TempDir(), "gun", "https://localhost", nil, passphrase.ConstantRetriever(passwd), trustpinning.TrustPinConfig{})
|
2018-03-06 14:44:13 -05:00
|
|
|
assert.NilError(t, err)
|
2017-09-26 20:16:18 -04:00
|
|
|
|
|
|
|
err = getOrGenerateRootKeyAndInitRepo(notaryRepo)
|
2018-03-06 15:54:24 -05:00
|
|
|
assert.Error(t, err, "client is offline")
|
2017-09-26 20:16:18 -04:00
|
|
|
}
|