1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-18 08:26:45 +02:00
woodpecker/vendor/github.com/samalba/dockerclient/mockclient/mock_test.go

33 lines
599 B
Go
Raw Normal View History

2015-05-22 20:37:40 +02:00
package mockclient
import (
"reflect"
"testing"
2015-09-30 03:21:17 +02:00
"github.com/samalba/dockerclient"
2015-05-22 20:37:40 +02:00
)
func TestMock(t *testing.T) {
mock := NewMockClient()
mock.On("Version").Return(&dockerclient.Version{Version: "foo"}, nil).Once()
v, err := mock.Version()
if err != nil {
t.Fatal(err)
}
if v.Version != "foo" {
t.Fatal(v)
}
mock.Mock.AssertExpectations(t)
}
func TestMockInterface(t *testing.T) {
iface := reflect.TypeOf((*dockerclient.Client)(nil)).Elem()
mock := NewMockClient()
if !reflect.TypeOf(mock).Implements(iface) {
t.Fatalf("Mock does not implement the Client interface")
}
}