Ejemplo n.º 1
0
def test_run(mocker):
    mock_args = mocker.MagicMock()
    mock_qt_args = []

    def fake_known_args():
        return (mock_args, mock_qt_args)

    mock_start_app = mocker.patch("securedrop_client.app.start_app")
    mocker.patch("argparse.ArgumentParser.parse_known_args", side_effect=fake_known_args)
    run()
    mock_start_app.assert_called_once_with(mock_args, mock_qt_args)
Ejemplo n.º 2
0
def test_run():
    mock_args = mock.MagicMock()
    mock_qt_args = []

    def fake_known_args():
        return (mock_args, mock_qt_args)

    with mock.patch('securedrop_client.app.start_app') as mock_start_app, \
            mock.patch('argparse.ArgumentParser.parse_known_args',
                       side_effect=fake_known_args):
        run()

        mock_start_app.assert_called_once_with(mock_args, mock_qt_args)
Ejemplo n.º 3
0
def test_run():
    """
    Ensure the expected things are configured and the application is started.
    """
    mock_session_class = mock.MagicMock()
    with mock.patch('securedrop_client.app.configure_logging') as conf_log, \
            mock.patch('securedrop_client.app.QApplication') as mock_app, \
            mock.patch('securedrop_client.app.Window') as mock_win, \
            mock.patch('securedrop_client.app.Client') as mock_client, \
            mock.patch('securedrop_client.app.sys') as mock_sys, \
            mock.patch('securedrop_client.app.sessionmaker',
                       return_value=mock_session_class):
        run()
        conf_log.assert_called_once_with()
        mock_app.assert_called_once_with(mock_sys.argv)
        mock_win.assert_called_once_with()
        mock_client.assert_called_once_with('http://localhost:8081/',
                                            mock_win(), mock_session_class())
Ejemplo n.º 4
0
#!/usr/bin/env python3
from securedrop_client.app import run

if __name__ == '__main__':
    run()