From 18c20080e85352ec091c396083a709ca25a640f3 Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Mon, 12 Sep 2011 23:21:40 +0100 Subject: [PATCH] Test handler for 671 replies. --- client/handlers_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/client/handlers_test.go b/client/handlers_test.go index 49ba77e..7139375 100644 --- a/client/handlers_test.go +++ b/client/handlers_test.go @@ -619,3 +619,30 @@ func Test353(t *testing.T) { m.ExpectNothing() c.ExpectError() } + +// Test the handler for 671 (unreal specific) +func Test671(t *testing.T) { + m, c := setUp(t) + defer tearDown(m, c) + + // Create user1, who should not be secure + user1 := c.NewNick("user1", "ident1", "name one", "host1.com") + if user1.Modes.SSL { + t.Errorf("Test nick user1 is already using SSL?") + } + + // Send a 671 reply + c.h_671(parseLine(":irc.server.org 671 test user1 :some ignored text")) + m.ExpectNothing() + c.ExpectNoErrors() + + // Ensure user1 is now known to be on an SSL connection + if !user1.Modes.SSL { + t.Errorf("Test nick user1 not using SSL?") + } + + // Check error paths -- send a 671 for an unknown nick + c.h_671(parseLine(":irc.server.org 671 test user2 :some ignored text")) + m.ExpectNothing() + c.ExpectError() +}