Пример #1
0
def test_LoginDialog_error():
    """
    Any error message passed in is assigned as the text for the error label.
    """
    mock_controller = mock.MagicMock()
    ld = LoginDialog(None)
    ld.setup(mock_controller)
    ld.error_label = mock.MagicMock()
    ld.error('foo')
    ld.error_label.setText.assert_called_once_with('foo')
Пример #2
0
def test_LoginDialog_reset():
    """
    Ensure the state of the login view is returned to the correct state.
    """
    mock_controller = mock.MagicMock()
    ld = LoginDialog(None)
    ld.setup(mock_controller)
    ld.username_field = mock.MagicMock()
    ld.password_field = mock.MagicMock()
    ld.tfa_field = mock.MagicMock()
    ld.setDisabled = mock.MagicMock()
    ld.error_label = mock.MagicMock()
    ld.reset()
    ld.username_field.setText.assert_called_once_with('')
    ld.password_field.setText.assert_called_once_with('')
    ld.tfa_field.setText.assert_called_once_with('')
    ld.setDisabled.assert_called_once_with(False)
    ld.error_label.setText.assert_called_once_with('')