real integration test

This commit is contained in:
didier.amyot committed 2014-10-19 10:17:49 -04:00
1 parent b52129817e
commit c20fa39e0f
4 files changed
+22 -4

No files matched your search

+2 -1
View File
@@ -4,10 +4,11 @@ import (
"archive/zip"
"bytes"
"errors"
"github.com/didiercrunch/filou/helper"
"io"
"reflect"
"testing"
"github.com/didiercrunch/filou/helper"
)
type mockPayload struct {
+5
View File
@@ -0,0 +1,5 @@
package integration
/*
Integration tests.
*/
+13 -2
View File
@@ -1,10 +1,12 @@
package integration
import (
"archive/zip"
"bytes"
"testing"
"github.com/didiercrunch/filou/envelop"
"github.com/didiercrunch/filou/helper"
"github.com/didiercrunch/filou/payload"
)
@@ -33,7 +35,16 @@ func (this *mockSigner) Sign(data []byte) ([]byte, error) {
func TestPayloadCanBeUseInEnvelop(t *testing.T) {
payload_ := payload.GetDefaultPayload(bytes.NewBufferString("some data to encrypt"))
envelop := envelop.NewEnveloper(&mockEncryptor{}, payload_, &mockSigner{})
if envelop == nil {
t.Fail()
w := helper.NewMockIoWriter()
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")
}
}
+2 -1
View File
@@ -4,10 +4,11 @@ import (
"bytes"
"errors"
"fmt"
"github.com/didiercrunch/filou/helper"
"io/ioutil"
"reflect"
"testing"
"github.com/didiercrunch/filou/helper"
)
func TestPayloadGetHashMethod(t *testing.T) {