# 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/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.models import WhoisFuture


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_whois_user_without_trigger(protocol):
    data = [
        ':server', '311', 'bot',
        'socek', 'realsocek', 'onet.pl', '*', 'the socketor',
    ]

# 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/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_whois.py
from grazyna.tests.commands.base import execute_message
from grazyna.irc.models import WhoisFuture



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_whois_user_without_trigger(protocol):
    data = [
        ':server', '311', 'bot',
        'socek', 'realsocek', 'onet.pl', '*', 'the socketor',
    ]

    execute_message(protocol, data)