# Path: grazyna/tests/commands/base.py
# def execute_message(protocol, data):
#     ctrl = MessageController(protocol, data)
#     ctrl.log = Mock()
#     ctrl.execute_message()
#     return ctrl
# 
# Path: grazyna/irc/exc.py
# class NoSuchNickError(Exception):
#     nick = None
#     
#     def __init__(self, nick):
#         self.nick = nick
# 
#     def __repr__(self):
#         return 'NoSuchNickError(%s)' % self.nick
# 
#     def __str__(self):
#         return repr(self)
# 
#     def __eq__(self, other):
#         return self.nick == other.nick
# 
# Path: grazyna/irc/models.py
# class WhoisFuture(asyncio.Future):
#     data = None
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self.data = WhoisData()


from grazyna.tests.commands.base import execute_message
from grazyna.irc.exc import NoSuchNickError
from grazyna.irc.models import WhoisFuture


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 == {}

# Path: grazyna/tests/commands/base.py
# def execute_message(protocol, data):
#     ctrl = MessageController(protocol, data)
#     ctrl.log = Mock()
#     ctrl.execute_message()
#     return ctrl
# 
# Path: grazyna/irc/exc.py
# class NoSuchNickError(Exception):
#     nick = None
#     
#     def __init__(self, nick):
#         self.nick = nick
# 
#     def __repr__(self):
#         return 'NoSuchNickError(%s)' % self.nick
# 
#     def __str__(self):
#         return repr(self)
# 
#     def __eq__(self, other):
#         return self.nick == other.nick
# 
# Path: grazyna/irc/models.py
# class WhoisFuture(asyncio.Future):
#     data = None
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self.data = WhoisData()


# Path: grazyna/tests/commands/test_command_no_such_nick.py
from grazyna.tests.commands.base import execute_message
from grazyna.irc.exc import NoSuchNickError
from grazyna.irc.models import WhoisFuture



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')