@@ -25,15 +25,15 @@ func TestCLI(t *testing.T) {
2525 os .Setenv ("KEYSTORE_PASSWORD" , "testpassword" )
2626
2727 // No error just listing help.
28- out , err : = runCommand (t , nil , "" )
28+ _ , err = runCommand (t , nil , "" )
2929 require .NoError (t , err )
3030
3131 // Create a key.
32- out , err = runCommand (t , nil , "create" , "-d" , `{"Keys": [{"KeyName": "testkey", "KeyType": "X25519"}]}` )
32+ _ , err = runCommand (t , nil , "create" , "-d" , `{"Keys": [{"KeyName": "testkey", "KeyType": "X25519"}]}` )
3333 require .NoError (t , err )
3434
3535 // List keys.
36- out , err = runCommand (t , nil , "get" , "-d" , `{"KeyNames": ["testkey"]}` )
36+ out , err : = runCommand (t , nil , "get" , "-d" , `{"KeyNames": ["testkey"]}` )
3737 require .NoError (t , err )
3838 resp := ks.GetKeysResponse {}
3939 err = json .Unmarshal (out .Bytes (), & resp )
@@ -43,7 +43,7 @@ func TestCLI(t *testing.T) {
4343 require .Equal (t , ks .X25519 , resp .Keys [0 ].KeyInfo .KeyType )
4444
4545 // Create a second key we export.
46- out , err = runCommand (t , nil , "create" , "-d" , `{"Keys": [{"KeyName": "testkey2", "KeyType": "ECDSA_S256"}]}` )
46+ _ , err = runCommand (t , nil , "create" , "-d" , `{"Keys": [{"KeyName": "testkey2", "KeyType": "ECDSA_S256"}]}` )
4747 require .NoError (t , err )
4848
4949 // Export the second key.
@@ -55,7 +55,7 @@ func TestCLI(t *testing.T) {
5555 exportedKey2Data := base64 .StdEncoding .EncodeToString (exportResp .Keys [0 ].Data )
5656
5757 // Delete the second key.
58- out , err = runCommand (t , nil , "delete" , "-d" , `{"KeyNames": ["testkey2"]}` , "--yes" )
58+ _ , err = runCommand (t , nil , "delete" , "-d" , `{"KeyNames": ["testkey2"]}` , "--yes" )
5959 require .NoError (t , err )
6060
6161 // List key should only see first.
@@ -69,7 +69,7 @@ func TestCLI(t *testing.T) {
6969 require .Equal (t , ks .X25519 , resp .Keys [0 ].KeyInfo .KeyType )
7070
7171 // Import the exported key.
72- out , err = runCommand (t , nil , "import" , "-d" , `{"Keys": [{"KeyName": "testkey2", "Data": "` + exportedKey2Data + `", "Password": "testpassword2"}]}` )
72+ _ , err = runCommand (t , nil , "import" , "-d" , `{"Keys": [{"KeyName": "testkey2", "Data": "` + exportedKey2Data + `", "Password": "testpassword2"}]}` )
7373 require .NoError (t , err )
7474
7575 // List keys.
@@ -86,7 +86,7 @@ func TestCLI(t *testing.T) {
8686
8787 // Set metadata on testkey.
8888 metadata := base64 .StdEncoding .EncodeToString ([]byte ("my-custom-metadata" ))
89- out , err = runCommand (t , nil , "set-metadata" , "-d" , `{"Updates": [{"KeyName": "testkey", "Metadata": "` + metadata + `"}]}` )
89+ _ , err = runCommand (t , nil , "set-metadata" , "-d" , `{"Updates": [{"KeyName": "testkey", "Metadata": "` + metadata + `"}]}` )
9090 require .NoError (t , err )
9191
9292 // Verify metadata was set.
@@ -111,7 +111,7 @@ func TestCLI(t *testing.T) {
111111 resp = ks.GetKeysResponse {}
112112 err = json .Unmarshal (out .Bytes (), & resp )
113113 require .NoError (t , err )
114- require .Len (t , resp .Keys , 0 )
114+ require .Empty (t , resp .Keys )
115115}
116116
117117func runCommand (t * testing.T , in * bytes.Buffer , args ... string ) (bytes.Buffer , error ) {
0 commit comments