traefik/provider/marathon/fake_client_test.go
Ludovic Fernandez 246b245959 Adds Marathon support.
Co-authored-by: Julien Salleyron <julien@containo.us>
2019-01-29 17:54:05 +01:00

24 lines
612 B
Go

package marathon
import (
"errors"
"github.com/containous/traefik/provider/marathon/mocks"
"github.com/gambol99/go-marathon"
"github.com/stretchr/testify/mock"
)
type fakeClient struct {
mocks.Marathon
}
func newFakeClient(applicationsError bool, applications marathon.Applications) *fakeClient {
// create an instance of our test object
fakeClient := new(fakeClient)
if applicationsError {
fakeClient.On("Applications", mock.Anything).Return(nil, errors.New("fake Marathon server error"))
} else {
fakeClient.On("Applications", mock.Anything).Return(&applications, nil)
}
return fakeClient
}