diff --git a/envelop/envelop_test.go b/envelop/envelop_test.go index 9d2fea4..c7100df 100644 --- a/envelop/envelop_test.go +++ b/envelop/envelop_test.go @@ -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 { diff --git a/integration/doc.go b/integration/doc.go new file mode 100644 index 0000000..b08b412 --- /dev/null +++ b/integration/doc.go @@ -0,0 +1,5 @@ +package integration + +/* +Integration tests. +*/ diff --git a/integration/enveloppayload_test.go b/integration/enveloppayload_test.go index 240dd4b..2bc206e 100644 --- a/integration/enveloppayload_test.go +++ b/integration/enveloppayload_test.go @@ -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") } } diff --git a/payload/payload_test.go b/payload/payload_test.go index 335c5c3..1452e0b 100644 --- a/payload/payload_test.go +++ b/payload/payload_test.go @@ -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) {