| 959 | } |
| 960 | |
| 961 | func TestDecryptComments(t *testing.T) { |
| 962 | tree := Tree{ |
| 963 | Branches: TreeBranches{ |
| 964 | TreeBranch{ |
| 965 | TreeItem{ |
| 966 | Key: Comment{Value: "oof"}, |
| 967 | Value: nil, |
| 968 | }, |
| 969 | TreeItem{ |
| 970 | Key: "list", |
| 971 | Value: []interface{}{ |
| 972 | "1", |
| 973 | Comment{Value: "rab"}, |
| 974 | "2", |
| 975 | }, |
| 976 | }, |
| 977 | TreeItem{ |
| 978 | Key: "list", |
| 979 | Value: nil, |
| 980 | }, |
| 981 | }, |
| 982 | }, |
| 983 | Metadata: Metadata{ |
| 984 | UnencryptedSuffix: DefaultUnencryptedSuffix, |
| 985 | }, |
| 986 | } |
| 987 | tree.Decrypt(bytes.Repeat([]byte{'f'}, 32), reverseCipher{}) |
| 988 | assert.Equal(t, "foo", tree.Branches[0][0].Key.(Comment).Value) |
| 989 | assert.Equal(t, "bar", tree.Branches[0][1].Value.([]interface{})[1]) |
| 990 | } |
| 991 | |
| 992 | func TestDecryptUnencryptedComments(t *testing.T) { |
| 993 | tree := Tree{ |