real integration test
This commit is contained in:
1 parent
b52129817e
commit
c20fa39e0f
4 files changed
+22
-4
No files matched your search
@@ -4,10 +4,11 @@ import (
|
|||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/didiercrunch/filou/helper"
|
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/didiercrunch/filou/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockPayload struct {
|
type mockPayload struct {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package integration
|
||||||
|
|
||||||
|
/*
|
||||||
|
Integration tests.
|
||||||
|
*/
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"archive/zip"
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/didiercrunch/filou/envelop"
|
"github.com/didiercrunch/filou/envelop"
|
||||||
|
"github.com/didiercrunch/filou/helper"
|
||||||
"github.com/didiercrunch/filou/payload"
|
"github.com/didiercrunch/filou/payload"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,7 +35,16 @@ func (this *mockSigner) Sign(data []byte) ([]byte, error) {
|
|||||||
func TestPayloadCanBeUseInEnvelop(t *testing.T) {
|
func TestPayloadCanBeUseInEnvelop(t *testing.T) {
|
||||||
payload_ := payload.GetDefaultPayload(bytes.NewBufferString("some data to encrypt"))
|
payload_ := payload.GetDefaultPayload(bytes.NewBufferString("some data to encrypt"))
|
||||||
envelop := envelop.NewEnveloper(&mockEncryptor{}, payload_, &mockSigner{})
|
envelop := envelop.NewEnveloper(&mockEncryptor{}, payload_, &mockSigner{})
|
||||||
if envelop == nil {
|
w := helper.NewMockIoWriter()
|
||||||
t.Fail()
|
if err := envelop.WriteToWriter(w); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
r, err := zip.NewReader(w.ReaderAt(), int64(w.Length()))
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(r.File) != 3 {
|
||||||
|
t.Error("wrong file number")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,11 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/didiercrunch/filou/helper"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/didiercrunch/filou/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPayloadGetHashMethod(t *testing.T) {
|
func TestPayloadGetHashMethod(t *testing.T) {
|
||||||
|
|||||||
Reference in new issue
Block a user