Skip to content

Commit 5096a99

Browse files
committed
Fix test
1 parent 1906533 commit 5096a99

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

keystore/encryptor_test.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,25 @@ func TestEncryptDecrypt(t *testing.T) {
7171
expectedEncryptError: keystore.ErrEncryptionFailed,
7272
}}
7373

74-
for fromKeyName, fromKey := range th.KeysByName() {
75-
for toKeyName, toKey := range th.KeysByName() {
76-
testName := fmt.Sprintf("Encrypt %s to %s", fromKeyName, toKeyName)
77-
var expectedEncryptError error
78-
if fromKey.keyType == toKey.keyType && fromKey.keyType.IsEncryptionKeyType() {
79-
// Same key types should succeed
80-
expectedEncryptError = nil
81-
} else {
82-
// Different key types or non-encryption key types should fail
83-
expectedEncryptError = keystore.ErrEncryptionFailed
84-
}
85-
86-
tt = append(tt, testCase{
87-
name: testName,
88-
remoteKeyType: fromKey.keyType,
89-
remotePubKey: toKey.publicKey,
90-
decryptKey: toKeyName,
91-
expectedEncryptError: expectedEncryptError,
92-
payload: []byte("hello world"),
93-
})
74+
for encName, encKey := range th.KeysByName() {
75+
testName := fmt.Sprintf("Encrypt to %s", encName)
76+
var expectedEncryptError error
77+
if encKey.keyType.IsEncryptionKeyType() {
78+
// Same key types should succeed
79+
expectedEncryptError = nil
80+
} else {
81+
// Different key types or non-encryption key types should fail
82+
expectedEncryptError = keystore.ErrEncryptionFailed
9483
}
84+
85+
tt = append(tt, testCase{
86+
name: testName,
87+
remoteKeyType: encKey.keyType,
88+
remotePubKey: encKey.publicKey,
89+
decryptKey: encName,
90+
expectedEncryptError: expectedEncryptError,
91+
payload: []byte("hello world"),
92+
})
9593
}
9694

9795
for _, tt := range tt {

0 commit comments

Comments
 (0)