goadb/host_client_test.go
Zach Klippenstein 9f7d11a3bc Refactored ClientConfig into a Server interface.
* StartServer is now a method on Server.
* What used to be Dialer.Dial is now Server.Dial.
* Server.Dial handles trying to start the server if the initial connection fails.
* Dialer now dials a network address.
* All types that took a Dialer now take a Server.
* Server now has tests!
2016-01-10 14:01:58 -08:00

22 lines
410 B
Go

package goadb
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/zach-klippenstein/goadb/wire"
)
func TestGetServerVersion(t *testing.T) {
s := &MockServer{
Status: wire.StatusSuccess,
Messages: []string{"000a"},
}
client := NewHostClient(s)
v, err := client.GetServerVersion()
assert.Equal(t, "host:version", s.Requests[0])
assert.NoError(t, err)
assert.Equal(t, 10, v)
}