Create separate package for mocks

This commit is contained in:
Lena Fuhrimann 2018-08-12 15:13:07 +02:00
parent 0434df0cf3
commit bb39bae31e
10 changed files with 17 additions and 11 deletions

2
go.mod
View file

@ -10,6 +10,6 @@ require (
github.com/pkg/errors v0.8.0
golang.org/x/crypto v0.0.0-20180808211826-de0752318171 // indirect
golang.org/x/net v0.0.0-20180811021610-c39426892332 // indirect
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0 // indirect
golang.org/x/sys v0.0.0-20180814072032-4e1fef560951 // indirect
golang.org/x/text v0.3.0 // indirect
)

4
go.sum
View file

@ -16,7 +16,7 @@ golang.org/x/crypto v0.0.0-20180808211826-de0752318171 h1:vYogbvSFj2YXcjQxFHu/rA
golang.org/x/crypto v0.0.0-20180808211826-de0752318171/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180811021610-c39426892332 h1:efGso+ep0DjyCBJPjvoz0HI6UldX4Md2F1rZFe1ir0E=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0 h1:8H8QZJ30plJyIVj60H3lr8TZGIq2Fh3Cyrs/ZNg1foU=
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180814072032-4e1fef560951 h1:VfGaXvV9wRnTJreeGDE0FWEDiQP1WWUDmutCjCThDz8=
golang.org/x/sys v0.0.0-20180814072032-4e1fef560951/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View file

@ -11,6 +11,7 @@ import (
"testing"
"github.com/mastertinner/s3manager/internal/app/s3manager"
"github.com/mastertinner/s3manager/internal/app/s3manager/mocks"
"github.com/matryer/is"
"github.com/matryer/way"
minio "github.com/minio/minio-go"
@ -117,7 +118,7 @@ func TestHandleBucketView(t *testing.T) {
t.Run(tcID, func(t *testing.T) {
is := is.New(t)
s3 := &S3Mock{
s3 := &mocks.S3Mock{
ListObjectsV2Func: tc.listObjectsV2Func,
}

View file

@ -9,6 +9,7 @@ import (
"testing"
"github.com/mastertinner/s3manager/internal/app/s3manager"
"github.com/mastertinner/s3manager/internal/app/s3manager/mocks"
"github.com/matryer/is"
minio "github.com/minio/minio-go"
)
@ -46,7 +47,7 @@ func TestHandleBucketsView(t *testing.T) {
t.Run(tcID, func(t *testing.T) {
is := is.New(t)
s3 := &S3Mock{
s3 := &mocks.S3Mock{
ListBucketsFunc: tc.listBucketsFunc,
}

View file

@ -9,6 +9,7 @@ import (
"testing"
"github.com/mastertinner/s3manager/internal/app/s3manager"
"github.com/mastertinner/s3manager/internal/app/s3manager/mocks"
"github.com/matryer/is"
)
@ -57,7 +58,7 @@ func TestHandleCreateBucket(t *testing.T) {
t.Run(tcID, func(t *testing.T) {
is := is.New(t)
s3 := &S3Mock{
s3 := &mocks.S3Mock{
MakeBucketFunc: tc.makeBucketFunc,
}

View file

@ -8,6 +8,7 @@ import (
"testing"
"github.com/mastertinner/s3manager/internal/app/s3manager"
"github.com/mastertinner/s3manager/internal/app/s3manager/mocks"
"github.com/matryer/is"
)
@ -37,7 +38,7 @@ func TestHandleDeleteBucket(t *testing.T) {
t.Run(tcID, func(t *testing.T) {
is := is.New(t)
s3 := &S3Mock{
s3 := &mocks.S3Mock{
RemoveBucketFunc: tc.removeBucketFunc,
}

View file

@ -8,6 +8,7 @@ import (
"testing"
"github.com/mastertinner/s3manager/internal/app/s3manager"
"github.com/mastertinner/s3manager/internal/app/s3manager/mocks"
"github.com/matryer/is"
)
@ -37,7 +38,7 @@ func TestHandleDeleteObject(t *testing.T) {
t.Run(tcID, func(t *testing.T) {
is := is.New(t)
s3 := &S3Mock{
s3 := &mocks.S3Mock{
RemoveObjectFunc: tc.removeObjectFunc,
}

View file

@ -10,6 +10,7 @@ import (
"testing"
"github.com/mastertinner/s3manager/internal/app/s3manager"
"github.com/mastertinner/s3manager/internal/app/s3manager/mocks"
"github.com/matryer/is"
"github.com/matryer/way"
minio "github.com/minio/minio-go"
@ -38,7 +39,7 @@ func TestHandleGetObject(t *testing.T) {
t.Run(tcID, func(t *testing.T) {
is := is.New(t)
s3 := &S3Mock{
s3 := &mocks.S3Mock{
GetObjectFunc: tc.getObjectFunc,
}

View file

@ -1,7 +1,7 @@
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package s3manager_test
package mocks
import (
"github.com/minio/minio-go"

View file

@ -6,7 +6,7 @@ import (
minio "github.com/minio/minio-go"
)
//go:generate moq -out s3_test.go -pkg s3manager_test . S3
//go:generate moq -out mocks/s3.go -pkg mocks . S3
// S3 is a client to interact with S3 storage.
type S3 interface {