diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/anachronistic/apns/client_mock_test.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/anachronistic/apns/client_mock_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/anachronistic/apns/client_mock_test.go b/Godeps/_workspace/src/github.com/anachronistic/apns/client_mock_test.go new file mode 100644 index 000000000..86e997b5a --- /dev/null +++ b/Godeps/_workspace/src/github.com/anachronistic/apns/client_mock_test.go @@ -0,0 +1,24 @@ +package apns + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestMockClientConnectAndWrite(t *testing.T) { + m := &MockClient{} + m.On("ConnectAndWrite", (*PushNotificationResponse)(nil), []byte(nil)).Return(nil) + assert.Nil(t, m.ConnectAndWrite(nil, nil)) + m.On("ConnectAndWrite", &PushNotificationResponse{}, []byte{}).Return(errors.New("test")) + assert.Equal(t, errors.New("test"), m.ConnectAndWrite(&PushNotificationResponse{}, []byte{})) +} + +func TestMockClientSend(t *testing.T) { + m := &MockClient{} + m.On("Send", (*PushNotification)(nil)).Return(nil) + assert.Nil(t, m.Send(nil)) + m.On("Send", &PushNotification{}).Return(&PushNotificationResponse{}) + assert.Equal(t, &PushNotificationResponse{}, m.Send(&PushNotification{})) +} |