fix test case

This commit is contained in:
19byte 2024-03-02 18:39:16 +08:00 committed by GitHub
parent b464391a45
commit 31f81ddee0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,14 +99,15 @@ func TestEnd2End(t *testing.T) {
d := t.TempDir()
s1 := &AESEncryptedStorage{
filename: fmt.Sprintf("%v/vault.json", d),
key: []byte("AES256Key-32Characters1234567890"),
}
s2 := &AESEncryptedStorage{
filename: fmt.Sprintf("%v/vault.json", d),
key: []byte("AES256Key-32Characters1234567890"),
}
s1 := NewAESEncryptedStorage(
fmt.Sprintf("%v/vault.json", d),
[]byte("AES256Key-32Characters1234567890"),
)
s2 := NewAESEncryptedStorage(
fmt.Sprintf("%v/vault.json", d),
[]byte("AES256Key-32Characters1234567890"),
)
s1.Put("bazonk", "foobar")
if v, err := s2.Get("bazonk"); v != "foobar" || err != nil {
@ -122,10 +123,10 @@ func TestSwappedKeys(t *testing.T) {
d := t.TempDir()
s1 := &AESEncryptedStorage{
filename: fmt.Sprintf("%v/vault.json", d),
key: []byte("AES256Key-32Characters1234567890"),
}
s1 := NewAESEncryptedStorage(
fmt.Sprintf("%v/vault.json", d),
[]byte("AES256Key-32Characters1234567890"),
)
s1.Put("k1", "v1")
s1.Put("k2", "v2")
// Now make a modified copy