Changeset 9e426c1 in sasview for src/sas/qtgui/UnitTesting/DataExplorerTest.py
- Timestamp:
- Jun 21, 2016 8:07:33 AM (8 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- f82ab8c
- Parents:
- 1042dba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/UnitTesting/DataExplorerTest.py
r1042dba r9e426c1 72 72 loadButton = self.form.cmdLoad 73 73 74 # Mock the system file open method 75 QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=None) 74 filename = "cyl_400_20.txt" 75 # Initialize signal spy instances 76 spy_file_read = QtSignalSpy(self.form, self.form.communicate.fileReadSignal) 77 78 # Return no files. 79 QtGui.QFileDialog.getOpenFileNames = MagicMock(return_value=None) 76 80 77 81 # Click on the Load button … … 79 83 80 84 # Test the getOpenFileName() dialog called once 81 self.assertTrue(QtGui.QFileDialog.getOpenFileName.called) 82 QtGui.QFileDialog.getOpenFileName.assert_called_once() 85 self.assertTrue(QtGui.QFileDialog.getOpenFileNames.called) 86 QtGui.QFileDialog.getOpenFileNames.assert_called_once() 87 88 # Make sure the signal has not been emitted 89 self.assertEqual(spy_file_read.count(), 0) 90 91 # Now, return a single file 92 QtGui.QFileDialog.getOpenFileNames = MagicMock(return_value=filename) 93 94 # Click on the Load button 95 QTest.mouseClick(loadButton, Qt.LeftButton) 96 97 # Test the getOpenFileName() dialog called once 98 self.assertTrue(QtGui.QFileDialog.getOpenFileNames.called) 99 QtGui.QFileDialog.getOpenFileNames.assert_called_once() 100 101 # Expected one spy instance 102 self.assertEqual(spy_file_read.count(), 1) 103 self.assertIn(filename, str(spy_file_read.called()[0]['args'][0])) 83 104 84 105 def testDeleteButton(self): … … 131 152 QTest.mouseClick(deleteButton, Qt.LeftButton) 132 153 133 134 154 def testSendToButton(self): 135 155 """ … … 166 186 # Assure the message box popped up 167 187 QtGui.QMessageBox.assert_called_once() 168 169 188 170 189 def testDataSelection(self): … … 272 291 Test the callback method updating the data object 273 292 """ 274 275 293 message="Loading Data Complete" 276 294 data_dict = {"a1":Data1D()}
Note: See TracChangeset
for help on using the changeset viewer.