@@ -14,16 +14,13 @@ import (
1414 "github.com/theupdateframework/notary"
1515 "github.com/theupdateframework/notary/client"
1616 "github.com/theupdateframework/notary/client/changelist"
17- "github.com/theupdateframework/notary/passphrase"
1817 "github.com/theupdateframework/notary/trustpinning"
1918 "github.com/theupdateframework/notary/tuf/data"
2019 "gotest.tools/v3/assert"
2120 is "gotest.tools/v3/assert/cmp"
2221 "gotest.tools/v3/skip"
2322)
2423
25- const passwd = "password"
26-
2724func TestTrustSignCommandErrors (t * testing.T ) {
2825 testCases := []struct {
2926 name string
@@ -83,7 +80,7 @@ func TestTrustSignCommandOfflineErrors(t *testing.T) {
8380}
8481
8582func TestGetOrGenerateNotaryKey (t * testing.T ) {
86- notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , passphrase . ConstantRetriever ( passwd ) , trustpinning.TrustPinConfig {})
83+ notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , testPassRetriever , trustpinning.TrustPinConfig {})
8784 assert .NilError (t , err )
8885
8986 // repo is empty, try making a root key
@@ -126,7 +123,7 @@ func TestGetOrGenerateNotaryKey(t *testing.T) {
126123func TestAddStageSigners (t * testing.T ) {
127124 skip .If (t , runtime .GOOS == "windows" , "FIXME: not supported currently" )
128125
129- notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , passphrase . ConstantRetriever ( passwd ) , trustpinning.TrustPinConfig {})
126+ notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , testPassRetriever , trustpinning.TrustPinConfig {})
130127 assert .NilError (t , err )
131128
132129 // stage targets/user
@@ -207,7 +204,7 @@ func TestAddStageSigners(t *testing.T) {
207204}
208205
209206func TestGetSignedManifestHashAndSize (t * testing.T ) {
210- notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , passphrase . ConstantRetriever ( passwd ) , trustpinning.TrustPinConfig {})
207+ notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , testPassRetriever , trustpinning.TrustPinConfig {})
211208 assert .NilError (t , err )
212209 _ , _ , err = getSignedManifestHashAndSize (notaryRepo , "test" )
213210 assert .Error (t , err , "client is offline" )
@@ -229,7 +226,7 @@ func TestGetReleasedTargetHashAndSize(t *testing.T) {
229226}
230227
231228func TestCreateTarget (t * testing.T ) {
232- notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , passphrase . ConstantRetriever ( passwd ) , trustpinning.TrustPinConfig {})
229+ notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , testPassRetriever , trustpinning.TrustPinConfig {})
233230 assert .NilError (t , err )
234231 _ , err = createTarget (notaryRepo , "" )
235232 assert .Error (t , err , "no tag specified" )
@@ -238,7 +235,7 @@ func TestCreateTarget(t *testing.T) {
238235}
239236
240237func TestGetExistingSignatureInfoForReleasedTag (t * testing.T ) {
241- notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , passphrase . ConstantRetriever ( passwd ) , trustpinning.TrustPinConfig {})
238+ notaryRepo , err := client .NewFileCachedRepository (t .TempDir (), "gun" , "https://localhost" , nil , testPassRetriever , trustpinning.TrustPinConfig {})
242239 assert .NilError (t , err )
243240 _ , err = getExistingSignatureInfoForReleasedTag (notaryRepo , "test" )
244241 assert .Error (t , err , "client is offline" )
@@ -267,7 +264,7 @@ func TestSignCommandChangeListIsCleanedOnError(t *testing.T) {
267264 err := cmd .Execute ()
268265 assert .Assert (t , err != nil )
269266
270- notaryRepo , err := client .NewFileCachedRepository (tmpDir , "docker.io/library/ubuntu" , "https://localhost" , nil , passphrase . ConstantRetriever ( passwd ) , trustpinning.TrustPinConfig {})
267+ notaryRepo , err := client .NewFileCachedRepository (tmpDir , "docker.io/library/ubuntu" , "https://localhost" , nil , testPassRetriever , trustpinning.TrustPinConfig {})
271268 assert .NilError (t , err )
272269 cl , err := notaryRepo .GetChangelist ()
273270 assert .NilError (t , err )
0 commit comments