Ejemplo n.º 1
0
def test_Client_logout(safe_tmpdir):
    """
    The API is reset to None and the UI is set to logged out state.
    """
    mock_gui = mock.MagicMock()
    mock_session = mock.MagicMock()
    cl = Client('http://localhost', mock_gui, mock_session, str(safe_tmpdir))
    cl.api = mock.MagicMock()
    cl.logout()
    assert cl.api is None
    cl.gui.logout.assert_called_once_with()
def test_Client_logout(homedir, config, mocker):
    """
    The API is reset to None and the UI is set to logged out state.
    The message and reply threads should also have the
    Using the `config` fixture to ensure the config is written to disk.
    """
    mock_gui = mocker.MagicMock()
    mock_session = mocker.MagicMock()
    cl = Client('http://localhost', mock_gui, mock_session, homedir)
    cl.api = mocker.MagicMock()
    cl.message_sync = mocker.MagicMock()
    cl.reply_sync = mocker.MagicMock()
    cl.message_sync.api = mocker.MagicMock()
    cl.reply_sync.api = mocker.MagicMock()
    cl.logout()
    assert cl.api is None
    assert cl.message_sync.api is None
    assert cl.reply_sync.api is None
    cl.gui.logout.assert_called_once_with()