| 990 | } |
| 991 | |
| 992 | func TestDecryptUnencryptedComments(t *testing.T) { |
| 993 | tree := Tree{ |
| 994 | Branches: TreeBranches{ |
| 995 | TreeBranch{ |
| 996 | TreeItem{ |
| 997 | // We use `error` to simulate an error decrypting, the fake cipher will error in this case |
| 998 | Key: Comment{Value: "error"}, |
| 999 | Value: nil, |
| 1000 | }, |
| 1001 | }, |
| 1002 | }, |
| 1003 | Metadata: Metadata{}, |
| 1004 | } |
| 1005 | tree.Decrypt(bytes.Repeat([]byte{'f'}, 32), reverseCipher{}) |
| 1006 | assert.Equal(t, "error", tree.Branches[0][0].Key.(Comment).Value) |
| 1007 | } |
| 1008 | |
| 1009 | func TestSetNewKey(t *testing.T) { |
| 1010 | branch := TreeBranch{ |