예제 #1
0
파일: irc.py 프로젝트: veiset/pyric
 def connect(self):
     ''' '''
     self.irc = socket.socket()
     connection.connect(self)
     self.connected = True
     self.connection = connection.StayAlive(self)
     self.connection.start()
예제 #2
0
    def test_that_connection_socket_sends_connection_data(self):
        connection.connect(self.pyric)

        e = self.irc.events
        e.reverse()

        assert e.pop() == ('bind', (self.pyric.ipaddr, self.pyric.port))
        assert e.pop() == ('connect', (self.pyric.server, self.pyric.port))
        assert e.pop() == ('send', bytes('NICK %s\n' % (self.pyric.nick),'UTF-8'))
        assert e.pop() == ('send', bytes('USER %s %s bla :%s\n' 
                            % (self.pyric.ident, self.pyric.server, self.pyric.name),'UTF-8'))

        # ensuring that no more events were recorded
        assert len(self.irc.events) == 0