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.refresh = mock.MagicMock() tb.set_logged_out() tb.user_state.setText.assert_called_once_with('Signed out.') tb.login.setVisible.assert_called_once_with(True) tb.logout.setVisible.assert_called_once_with(False) tb.refresh.setVisible.assert_called_once_with(False)
def test_ToolBar_set_logged_in_as(): """Given a username, the user_state is updated and login/logout buttons, and refresh buttons, are in the correct state. """ tb = ToolBar(None) tb.user_state = mock.MagicMock() tb.login = mock.MagicMock() tb.logout = mock.MagicMock() tb.refresh = mock.MagicMock() tb.set_logged_in_as('test') tb.user_state.setText.assert_called_once_with('Signed in as: test') tb.login.setVisible.assert_called_once_with(False) tb.logout.setVisible.assert_called_once_with(True) tb.refresh.setVisible.assert_called_once_with(True)