Exemple #1
0
def test_ToolBar_set_logged_out():
    """
    Ensure the UI reverts to the logged out state.
    """
    tb = ToolBar(None)
    tb.user_state = mock.MagicMock()
    tb.login = mock.MagicMock()
    tb.logout = mock.MagicMock()
    tb.set_logged_out()
    tb.user_state.setText.assert_called_once_with('Logged out.')
    tb.login.setVisible.assert_called_once_with(True)
    tb.logout.setVisible.assert_called_once_with(False)
Exemple #2
0
def test_ToolBar_set_logged_in_as():
    """
    Given a username, the user_state is updated and login/logout buttons are
    in the correct state.
    """
    tb = ToolBar(None)
    tb.user_state = mock.MagicMock()
    tb.login = mock.MagicMock()
    tb.logout = mock.MagicMock()
    tb.set_logged_in_as('test')
    tb.user_state.setText.assert_called_once_with('Logged in as: test')
    tb.login.setVisible.assert_called_once_with(False)
    tb.logout.setVisible.assert_called_once_with(True)