def test__run_printer_preflight_raises_ExportError_if_not_empty_string(mocker): """ Ensure ExportError is raised if _run_disk_test returns anything other than 'USB_CONNECTED'. """ export = Export() export._create_archive = mocker.MagicMock(return_value="mock_archive_path") export._export_archive = mocker.MagicMock( return_value="SOMETHING_OTHER_THAN_EMPTY_STRING") with pytest.raises(ExportError): export._run_printer_preflight("mock_archive_dir")
def test__run_printer_preflight(mocker): """ Ensure _export_archive and _create_archive are called with the expected parameters, _export_archive is called with the return value of _create_archive, and _run_disk_test returns without error if 'USB_CONNECTED' is the return value of _export_archive. """ export = Export() export._create_archive = mocker.MagicMock(return_value="mock_archive_path") export._export_archive = mocker.MagicMock(return_value="") export._run_printer_preflight("mock_archive_dir") export._export_archive.assert_called_once_with("mock_archive_path") export._create_archive.assert_called_once_with( "mock_archive_dir", "printer-preflight.sd-export", {"device": "printer-preflight"})
def test__run_printer_preflight(mocker): ''' Ensure _export_archive and _create_archive are called with the expected parameters, _export_archive is called with the return value of _create_archive, and _run_disk_test returns without error if 'USB_CONNECTED' is the return value of _export_archive. ''' export = Export() export._create_archive = mocker.MagicMock(return_value='mock_archive_path') export._export_archive = mocker.MagicMock(return_value='') export._run_printer_preflight('mock_archive_dir') export._export_archive.assert_called_once_with('mock_archive_path') export._create_archive.assert_called_once_with( 'mock_archive_dir', 'printer-preflight.sd-export', {'device': 'printer-preflight'})