Ignore:
Timestamp:
Feb 2, 2018 9:21:48 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
a90c9c5
Parents:
5e66738
Message:

More code review related fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r63319b0 r14ec91c5  
    1717from sas.qtgui.Utilities.GuiUtils import * 
    1818from sas.qtgui.Perspectives.Fitting.FittingWidget import * 
    19 from sas.qtgui.Perspectives.Fitting.Constraints import Constraint 
     19from sas.qtgui.Perspectives.Fitting.Constraint import Constraint 
    2020 
    2121from sas.qtgui.UnitTesting.TestUtils import QtSignalSpy 
     
    787787            self.assertEqual(update_spy.count(), 1) 
    788788 
    789     # test disabled until pyqt5 deals with html properly 
    790     def notestOnHelp(self): 
     789    def testOnHelp(self): 
    791790        """ 
    792791        Test various help pages shown in this widget 
    793792        """ 
    794         #Mock the QWebView method 
    795         QtWebKit.QWebView.show = MagicMock() 
    796         QtWebKit.QWebView.load = MagicMock() 
     793        #Mock the webbrowser.open method 
     794        self.widget.parent.showHelp = MagicMock() 
     795        #webbrowser.open = MagicMock() 
    797796 
    798797        # Invoke the action on default tab 
    799798        self.widget.onHelp() 
    800799        # Check if show() got called 
    801         self.assertTrue(QtWebKit.QWebView.show.called) 
     800        self.assertTrue(self.widget.parent.showHelp.called) 
    802801        # Assure the filename is correct 
    803         self.assertIn("fitting_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     802        self.assertIn("fitting_help.html", self.widget.parent.showHelp.call_args[0][0]) 
    804803 
    805804        # Change the tab to options 
     
    807806        self.widget.onHelp() 
    808807        # Check if show() got called 
    809         self.assertEqual(QtWebKit.QWebView.show.call_count, 2) 
     808        self.assertEqual(self.widget.parent.showHelp.call_count, 2) 
    810809        # Assure the filename is correct 
    811         self.assertIn("residuals_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     810        self.assertIn("residuals_help.html", self.widget.parent.showHelp.call_args[0][0]) 
    812811 
    813812        # Change the tab to smearing 
     
    815814        self.widget.onHelp() 
    816815        # Check if show() got called 
    817         self.assertEqual(QtWebKit.QWebView.show.call_count, 3) 
     816        self.assertEqual(self.widget.parent.showHelp.call_count, 3) 
    818817        # Assure the filename is correct 
    819         self.assertIn("sm_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     818        self.assertIn("resolution.html", self.widget.parent.showHelp.call_args[0][0]) 
    820819 
    821820        # Change the tab to poly 
     
    823822        self.widget.onHelp() 
    824823        # Check if show() got called 
    825         self.assertEqual(QtWebKit.QWebView.show.call_count, 4) 
     824        self.assertEqual(self.widget.parent.showHelp.call_count, 4) 
    826825        # Assure the filename is correct 
    827         self.assertIn("pd_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     826        self.assertIn("polydispersity.html", self.widget.parent.showHelp.call_args[0][0]) 
    828827 
    829828        # Change the tab to magnetism 
     
    831830        self.widget.onHelp() 
    832831        # Check if show() got called 
    833         self.assertEqual(QtWebKit.QWebView.show.call_count, 5) 
     832        self.assertEqual(self.widget.parent.showHelp.call_count, 5) 
    834833        # Assure the filename is correct 
    835         self.assertIn("mag_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     834        self.assertIn("magnetism.html", self.widget.parent.showHelp.call_args[0][0]) 
    836835 
    837836    def testReadFitPage(self): 
Note: See TracChangeset for help on using the changeset viewer.