Debian Codegraph @

mockclient/mock_test.go

raw symbols SCIP
1 package mockclient
2
3 import (
4 "reflect"
5 "testing"
6
7 "github.com/samalba/dockerclient"
8 )
9
10 func TestMock(t *testing.T) {
11 mock := NewMockClient()
12 mock.On("Version").Return(&dockerclient.Version{Version: "foo"}, nil).Once()
13
14 v, err := mock.Version()
15 if err != nil {
16 t.Fatal(err)
17 }
18 if v.Version != "foo" {
19 t.Fatal(v)
20 }
21
22 mock.Mock.AssertExpectations(t)
23 }
24
25 func TestMockInterface(t *testing.T) {
26 iface := reflect.TypeOf((*dockerclient.Client)(nil)).Elem()
27 mock := NewMockClient()
28
29 if !reflect.TypeOf(mock).Implements(iface) {
30 t.Fatalf("Mock does not implement the Client interface")
31 }
32 }