Skip to content

Commit

Permalink
test more paths for opening and exporting a file
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Oct 22, 2019
1 parent 03f4a5e commit 3d22675
Show file tree
Hide file tree
Showing 3 changed files with 313 additions and 44 deletions.
3 changes: 1 addition & 2 deletions securedrop_client/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import logging
import os
import sdclientapi
import threading
import uuid
from typing import Dict, Tuple, Union, Any, List, Type # noqa: F401

Expand Down Expand Up @@ -591,7 +590,7 @@ def on_file_open(self, file_uuid: str) -> None:
fn_no_ext, dummy = os.path.splitext(os.path.splitext(file.filename)[0])
filepath = os.path.join(self.data_dir, fn_no_ext)
if not os.path.exists(filepath):
msg = _('Could not export {}. File does not exist.'.format(file.original_filename))
msg = _('Could not open {}. File does not exist.'.format(file.original_filename))
storage.mark_as_not_downloaded(file_uuid, self.session)
self.sync_api()
logger.debug(msg)
Expand Down
6 changes: 3 additions & 3 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ def test_FileWidget__on_export_clicked(mocker, session, source):

fw._on_export_clicked()

controller.run_export_preflight_checks.assert_called_once_with()
controller.run_export_preflight_checks.assert_called_once_with(file.uuid)


def test_ExportDialog_export(mocker):
Expand All @@ -1450,7 +1450,7 @@ def test_ExportDialog_export(mocker):

export_dialog.export()

controller.run_export_preflight_checks.assert_called_with()
controller.run_export_preflight_checks.assert_called_with('mock_uuid')


def test_ExportDialog_pre_flight_request_to_insert_usb_device_on_CALLED_PROCESS_ERROR(mocker):
Expand Down Expand Up @@ -1500,7 +1500,7 @@ def test_ExportDialog__on_retry_export_button_clicked(mocker):

export_dialog._on_retry_export_button_clicked()

controller.run_export_preflight_checks.assert_called_with()
controller.run_export_preflight_checks.assert_called_with('mock_uuid')


def test_ExportDialog__update_export_button_clicked_USB_NOT_CONNECTED(mocker):
Expand Down
Loading

0 comments on commit 3d22675

Please sign in to comment.