From aa9fced4e1fd84d4a269bf9aa390476e42a64a1c Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Wed, 10 Feb 2016 23:24:07 +1000 Subject: [PATCH] client: Since we use one function for testing, also use one function for setting config values --- client/reactor_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/client/reactor_test.go b/client/reactor_test.go index e666347..3c64190 100644 --- a/client/reactor_test.go +++ b/client/reactor_test.go @@ -23,9 +23,7 @@ func TestPlainConnection(t *testing.T) { reactor := NewReactor() client := reactor.CreateServer("local") - client.InitialNick = "coolguy" - client.InitialUser = "c" - client.InitialRealName = "girc-go Test Client " + initialiseServerConnection(client) // we mock up a server connection to test the client listener, _ := net.Listen("tcp", ":0") @@ -40,9 +38,7 @@ func TestTLSConnection(t *testing.T) { reactor := NewReactor() client := reactor.CreateServer("local") - client.InitialNick = "coolguy" - client.InitialUser = "c" - client.InitialRealName = "girc-go Test Client " + initialiseServerConnection(client) // generate a test certificate to use priv, _ := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) @@ -113,6 +109,12 @@ func sendMessage(conn net.Conn, tags *map[string]ircmsg.TagValue, prefix string, time.Sleep(waitTime) } +func initialiseServerConnection(client *ServerConnection) { + client.InitialNick = "coolguy" + client.InitialUser = "c" + client.InitialRealName = "girc-go Test Client " +} + func testServerConnection(t *testing.T, reactor Reactor, client *ServerConnection, listener net.Listener) { // start our reader conn, _ := listener.Accept()