Update tests
This commit is contained in:
parent
814fee772f
commit
e8bb3f0654
1 changed files with 44 additions and 0 deletions
|
@ -56,6 +56,20 @@ func TestBlank(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func TestCorrupt(t *testing.T) {
|
||||
|
||||
key := []byte("1hg7dbrma8ghe547")
|
||||
enc := []byte("corrupt")
|
||||
|
||||
Convey("Cryptography should fail", t, func() {
|
||||
dec, _ := Decrypt(key, enc)
|
||||
Convey("Decrypt", func() {
|
||||
So(dec, ShouldResemble, enc)
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestInvalid(t *testing.T) {
|
||||
|
||||
key := []byte("invalidkey")
|
||||
|
@ -74,6 +88,36 @@ func TestInvalid(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func TestInvalidD(t *testing.T) {
|
||||
|
||||
val := []byte("1hg7dbrma8ghe547")
|
||||
key := []byte("invalidkey")
|
||||
str := []byte("Hello World")
|
||||
|
||||
Convey("Decryption should fail", t, func() {
|
||||
enc, _ := Encrypt(val, str)
|
||||
dec, _ := Decrypt(key, enc)
|
||||
Convey("Decrypt", func() {
|
||||
So(dec, ShouldResemble, []byte(nil))
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestInvalidE(t *testing.T) {
|
||||
|
||||
key := []byte("invalidkey")
|
||||
str := []byte("Hello World")
|
||||
|
||||
Convey("Encryption should fail", t, func() {
|
||||
enc, _ := Encrypt(key, str)
|
||||
Convey("Encrypt", func() {
|
||||
So(enc, ShouldResemble, []byte(nil))
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestAES128(t *testing.T) {
|
||||
|
||||
key := []byte("1hg7dbrma8ghe547")
|
||||
|
|
Loading…
Reference in a new issue