my computer is about to die!!!
This commit is contained in:
1 parent
d863dc3bd1
commit
e80f2601ab
13 files changed
+244
-11
No files matched your search
@@ -2,12 +2,14 @@ package payload
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/didiercrunch/filou/contract"
|
||||
"github.com/didiercrunch/filou/helper"
|
||||
)
|
||||
|
||||
@@ -166,3 +168,23 @@ func TestGetDefaultPayload(t *testing.T) {
|
||||
errorC <- errors.New("hash has not been computed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetPayload(t *testing.T) {
|
||||
c := &contract.AcceptedContract{Hash: "sha512"}
|
||||
p, err := GetPayload(nil, c)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
expectedPayload := &Payload{
|
||||
DataSource: nil,
|
||||
Random: rand.Reader,
|
||||
HashMethod: SHA512,
|
||||
Block: AES256,
|
||||
BlockMode: OFB,
|
||||
}
|
||||
if p.HashMethod != expectedPayload.HashMethod {
|
||||
t.Error("bad hash method")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user