def whois(self, nick): """ :type nick: str :return: WhoisData """ self.whois_heap[nick] = future = WhoisFuture() self.send('WHOIS', nick) result = yield from future return result
def test_whois_user(protocol): data = [ ':server', '311', 'bot', 'socek', 'realsocek', 'onet.pl', '*', 'the socketor', ] future = protocol.whois_heap['socek'] = WhoisFuture() execute_message(protocol, data) assert future.data.nick == 'socek' assert future.data.ircname == 'the socketor' assert future.data.host == 'onet.pl' assert future.data.realname == 'realsocek'
def test_command_no_such_nick(protocol): data = [ ':server', '401', 'bot', 'socek', ':No such nick/channel', ] future = protocol.whois_heap['socek'] = WhoisFuture() execute_message(protocol, data) assert protocol.whois_heap == {} assert future.exception() == NoSuchNickError('socek')
def test_whois_end(protocol): data = [':server', '318', 'bot', 'socek', 'End of /WHOIS list'] future = protocol.whois_heap['socek'] = WhoisFuture() execute_message(protocol, data) assert future.result() is future.data
def test_whois_account(protocol): data = [':server', '330', 'bot', 'socek', 'socketor'] future = protocol.whois_heap['socek'] = WhoisFuture() execute_message(protocol, data) assert future.data.account == 'socketor'
def test_whois_channels(protocol): data = [':server', '319', 'bot', 'socek', '#foo #bar'] future = protocol.whois_heap['socek'] = WhoisFuture() execute_message(protocol, data) assert future.data.channels == ['#foo', '#bar']
def test_whois_idle(protocol): data = [':server', '317', 'bot', 'socek', '30', 'seconds idle'] future = protocol.whois_heap['socek'] = WhoisFuture() execute_message(protocol, data) assert future.data.idle == 30
def test_whois_server(protocol): data = [':server', '312', 'bot', 'socek', 'banana server'] future = protocol.whois_heap['socek'] = WhoisFuture() execute_message(protocol, data) assert future.data.server == 'banana server'