Back to index

apport  2.4
Public Member Functions | Public Attributes
test_ui_kde.T Class Reference

List of all members.

Public Member Functions

def setUpClass
def setUp
def tearDown
def test_close_button
def test_kernel_crash_layout
def test_package_crash_layout
def test_regular_crash_layout
def test_regular_crash_layout_restart
def test_system_crash_layout
def test_apport_bug_package_layout
def test_recoverable_crash_layout
def test_1_crash_nodetails
def test_1_crash_details
def test_1_crash_noaccept
def test_bug_report_installed_package
def test_bug_report_uninstalled_package
def test_1_update_report
def test_1_update_report_different_binary_source
def test_administrator_disabled_reporting

Public Attributes

 report_dir
 app
 hook_dir
 visible_progress

Detailed Description

Definition at line 38 of file test_ui_kde.py.


Member Function Documentation

def test_ui_kde.T.setUp (   self)

Definition at line 45 of file test_ui_kde.py.

00045 
00046     def setUp(self):
00047         self.report_dir = tempfile.mkdtemp()
00048         apport.fileutils.report_dir = self.report_dir
00049         os.environ['APPORT_REPORT_DIR'] = self.report_dir
00050         # do not cause eternal hangs because of error dialog boxes
00051         os.environ['APPORT_DISABLE_DISTRO_CHECK'] = '1'
00052 
00053         self.app = MainUserInterface()
00054 
00055         # use in-memory crashdb
00056         self.app.crashdb = apport.crashdb_impl.memory.CrashDatabase(None, {})
00057 
00058         # disable package hooks, as they might ask for sudo password and other
00059         # interactive bits; allow tests to install their own hooks
00060         self.hook_dir = tempfile.mkdtemp()
00061         apport.report._hook_dir = self.hook_dir
00062         apport.report._common_hook_dir = self.hook_dir
00063 
00064         # test report
00065         self.app.report_file = os.path.join(self.report_dir, 'bash.crash')
00066 
00067         self.app.report = apport.Report()
00068         self.app.report['ExecutablePath'] = '/bin/bash'
00069         self.app.report['Signal'] = '11'
00070         self.app.report['CoreDump'] = b'\x01\x02'
00071         with open(self.app.report_file, 'wb') as f:
00072             self.app.report.write(f)

def test_ui_kde.T.setUpClass (   klass)

Definition at line 40 of file test_ui_kde.py.

00040 
00041     def setUpClass(klass):
00042         r = apport.Report()
00043         r.add_os_info()
00044         klass.distro = r['DistroRelease']

def test_ui_kde.T.tearDown (   self)

Definition at line 73 of file test_ui_kde.py.

00073 
00074     def tearDown(self):
00075         if self.app.dialog:
00076             QCoreApplication.processEvents()
00077             self.app.dialog.done(0)
00078             QCoreApplication.processEvents()
00079 
00080         shutil.rmtree(self.report_dir)
00081         shutil.rmtree(self.hook_dir)

def test_ui_kde.T.test_1_crash_details (   self,
  args 
)
Crash report with showing details

Definition at line 360 of file test_ui_kde.py.

00360 
00361     def test_1_crash_details(self, *args):
00362         '''Crash report with showing details'''
00363 
00364         self.visible_progress = None
00365 
00366         def show_details(*args):
00367             if self.app.dialog and self.app.dialog.show_details.isVisible():
00368                 self.app.dialog.show_details.click()
00369                 QTimer.singleShot(1000, cont)
00370                 return
00371 
00372             # try again
00373             QTimer.singleShot(200, show_details)
00374 
00375         def cont(*args):
00376             # wait until data collection is done and tree filled
00377             details = self.app.dialog.findChild(QTreeWidget, 'details')
00378             if details.topLevelItemCount() == 0:
00379                 QTimer.singleShot(200, cont)
00380                 return
00381 
00382             if self.app.dialog and self.app.dialog.continue_button.isVisible():
00383                 self.app.dialog.continue_button.click()
00384                 QTimer.singleShot(500, check_progress)
00385                 return
00386             # try again
00387             QTimer.singleShot(200, cont)
00388 
00389         def check_progress(*args):
00390             self.visible_progress = (self.app.progress is not None)
00391 
00392         QTimer.singleShot(200, show_details)
00393         self.app.run_crash(self.app.report_file)
00394 
00395         # we should have reported one crash
00396         self.assertEqual(self.app.crashdb.latest_id(), 0)
00397         r = self.app.crashdb.download(0)
00398         self.assertEqual(r['ProblemType'], 'Crash')
00399         self.assertEqual(r['ExecutablePath'], '/bin/bash')
00400 
00401         # we already collected details, do not show the progress dialog again
00402         self.assertFalse(self.visible_progress)
00403 
00404         # data was collected
00405         self.assertTrue(r['Package'].startswith('bash '))
00406         self.assertTrue('libc' in r['Dependencies'])
00407         self.assertTrue('Stacktrace' in r)
00408 
00409         # URL was opened
00410         self.assertEqual(self.app.open_url.call_count, 1)

def test_ui_kde.T.test_1_crash_noaccept (   self,
  args 
)
Crash report with non-accepting crash DB

Definition at line 412 of file test_ui_kde.py.

00412 
00413     def test_1_crash_noaccept(self, *args):
00414         '''Crash report with non-accepting crash DB'''
00415 
00416         self.visible_progress = None
00417 
00418         def cont(*args):
00419             if self.app.dialog and self.app.dialog.continue_button.isVisible():
00420                 self.app.dialog.continue_button.click()
00421                 QTimer.singleShot(500, check_progress)
00422                 return
00423             # try again
00424             QTimer.singleShot(1000, cont)
00425 
00426         def check_progress(*args):
00427             self.visible_progress = (self.app.progress is not None)
00428 
00429         QTimer.singleShot(1000, cont)
00430         self.app.crashdb.options['problem_types'] = ['bug']
00431         self.app.run_crash(self.app.report_file)
00432 
00433         # we should not have reported the crash
00434         self.assertEqual(self.app.crashdb.latest_id(), -1)
00435         self.assertEqual(self.app.open_url.call_count, 0)
00436 
00437         # no progress dialog for non-accepting DB
00438         self.assertEqual(self.visible_progress, False)
00439 
00440         # data was collected for whoopsie
00441         r = self.app.report
00442         self.assertEqual(r['ProblemType'], 'Crash')
00443         self.assertEqual(r['ExecutablePath'], '/bin/bash')
00444         self.assertTrue(r['Package'].startswith('bash '))
00445         self.assertTrue('libc' in r['Dependencies'])
00446         self.assertTrue('Stacktrace' in r)

def test_ui_kde.T.test_1_crash_nodetails (   self,
  args 
)
Crash report without showing details

Definition at line 323 of file test_ui_kde.py.

00323 
00324     def test_1_crash_nodetails(self, *args):
00325         '''Crash report without showing details'''
00326 
00327         self.visible_progress = None
00328 
00329         def cont(*args):
00330             if self.app.dialog and self.app.dialog.continue_button.isVisible():
00331                 self.app.dialog.continue_button.click()
00332                 QTimer.singleShot(500, check_progress)
00333                 return
00334             # try again
00335             QTimer.singleShot(1000, cont)
00336 
00337         def check_progress(*args):
00338             self.visible_progress = (self.app.progress is not None)
00339 
00340         QTimer.singleShot(1000, cont)
00341         self.app.run_crash(self.app.report_file)
00342 
00343         # we should have reported one crash
00344         self.assertEqual(self.app.crashdb.latest_id(), 0)
00345         r = self.app.crashdb.download(0)
00346         self.assertEqual(r['ProblemType'], 'Crash')
00347         self.assertEqual(r['ExecutablePath'], '/bin/bash')
00348 
00349         # should show a progress bar for info collection
00350         self.assertEqual(self.visible_progress, True)
00351 
00352         # data was collected
00353         self.assertTrue(r['Package'].startswith('bash '))
00354         self.assertTrue('libc' in r['Dependencies'])
00355         self.assertTrue('Stacktrace' in r)
00356 
00357         # URL was opened
00358         self.assertEqual(self.app.open_url.call_count, 1)

def test_ui_kde.T.test_1_update_report (   self,
  args 
)
Updating an existing report

Definition at line 492 of file test_ui_kde.py.

00492 
00493     def test_1_update_report(self, *args):
00494         '''Updating an existing report'''
00495 
00496         self.app.report_file = None
00497 
00498         def cont(*args):
00499             if self.app.dialog and self.app.dialog.continue_button.isVisible():
00500                 self.app.dialog.continue_button.click()
00501                 return
00502             # try again
00503             QTimer.singleShot(200, cont)
00504 
00505         # upload empty report
00506         id = self.app.crashdb.upload({})
00507         self.assertEqual(id, 0)
00508         self.app.options.update_report = 0
00509         self.app.options.package = 'bash'
00510 
00511         QTimer.singleShot(200, cont)
00512         self.app.run_update_report()
00513 
00514         # no new bug reported
00515         self.assertEqual(self.app.crashdb.latest_id(), 0)
00516 
00517         # bug was updated
00518         r = self.app.crashdb.download(0)
00519         self.assertTrue(r['Package'].startswith('bash '))
00520         self.assertTrue('libc' in r['Dependencies'])
00521         self.assertTrue('DistroRelease' in r)
00522 
00523         # No URL in this mode
00524         self.assertEqual(self.app.open_url.call_count, 0)

Updating an existing report on a source package which does not have a binary of the same name

Definition at line 526 of file test_ui_kde.py.

00526 
00527     def test_1_update_report_different_binary_source(self, *args):
00528         '''Updating an existing report on a source package which does not have a binary of the same name'''
00529 
00530         self.app.report_file = None
00531 
00532         def cont(*args):
00533             if self.app.dialog and self.app.dialog.continue_button.isVisible():
00534                 self.app.dialog.continue_button.click()
00535                 return
00536             # try again
00537             QTimer.singleShot(200, cont)
00538 
00539         kernel_pkg = apport.packaging.get_kernel_package()
00540         kernel_src = apport.packaging.get_source(kernel_pkg)
00541         self.assertNotEqual(kernel_pkg, kernel_src,
00542                             'this test assumes that the kernel binary package != kernel source package')
00543         self.assertNotEqual(apport.packaging.get_version(kernel_pkg), '',
00544                             'this test assumes that the kernel binary package %s is installed' % kernel_pkg)
00545         # this test assumes that the kernel source package name is not an
00546         # installed binary package
00547         self.assertRaises(ValueError, apport.packaging.get_version, kernel_src)
00548 
00549         # create source package hook, as otherwise there is nothing to collect
00550         with open(os.path.join(self.hook_dir, 'source_%s.py' % kernel_src), 'w') as f:
00551             f.write('def add_info(r, ui):\n r["MachineType"]="Laptop"\n')
00552 
00553         # upload empty report
00554         id = self.app.crashdb.upload({})
00555         self.assertEqual(id, 0)
00556 
00557         # run in update mode for that bug
00558         self.app.options.update_report = 0
00559         self.app.options.package = kernel_src
00560 
00561         QTimer.singleShot(200, cont)
00562         self.app.run_update_report()
00563 
00564         # no new bug reported
00565         self.assertEqual(self.app.crashdb.latest_id(), 0)
00566 
00567         # bug was updated
00568         r = self.app.crashdb.download(0)
00569         self.assertTrue('ProcEnviron' in r)
00570         self.assertTrue('DistroRelease' in r)
00571         self.assertTrue('Uname' in r)
00572         self.assertEqual(r['MachineType'], 'Laptop')
00573 
00574         # No URL in this mode
00575         self.assertEqual(self.app.open_url.call_count, 0)

Definition at line 576 of file test_ui_kde.py.

00576 
00577     def test_administrator_disabled_reporting(self):
00578         QTimer.singleShot(0, QCoreApplication.quit)
00579         self.app.ui_present_report_details(False)
00580         self.assertFalse(self.app.dialog.send_error_report.isVisible())
00581         self.assertFalse(self.app.dialog.send_error_report.isChecked())

+-------------------------------------------------------------------+
| [ error  ] Send problem report to the developers?                 |
|                                                                   |
|            +----------------------------------------------------+ |
|            | |> ApportVersion                                   | |
|            | ...                                                | |
|            +----------------------------------------------------+ |
|                                                                   |
| [ Cancel ]                                               [ Send ] |
+-------------------------------------------------------------------+

Definition at line 255 of file test_ui_kde.py.

00255 
00256     def test_apport_bug_package_layout(self):
00257         '''
00258         +-------------------------------------------------------------------+
00259         | [ error  ] Send problem report to the developers?                 |
00260         |                                                                   |
00261         |            +----------------------------------------------------+ |
00262         |            | |> ApportVersion                                   | |
00263         |            | ...                                                | |
00264         |            +----------------------------------------------------+ |
00265         |                                                                   |
00266         | [ Cancel ]                                               [ Send ] |
00267         +-------------------------------------------------------------------+
00268         '''
00269         self.app.report_file = None
00270         QTimer.singleShot(0, QCoreApplication.quit)
00271         self.app.ui_present_report_details(True)
00272         self.assertEqual(self.app.dialog.windowTitle(), self.distro.split()[0])
00273         self.assertEqual(self.app.dialog.heading.text(),
00274                          _('Send problem report to the developers?'))
00275         self.assertFalse(self.app.dialog.text.isVisible())
00276         self.assertFalse(self.app.dialog.send_error_report.isVisible())
00277         self.assertTrue(self.app.dialog.send_error_report.isChecked())
00278         self.assertFalse(self.app.dialog.details.isVisible())
00279         self.assertTrue(self.app.dialog.continue_button.isVisible())
00280         self.assertEqual(self.app.dialog.continue_button.text(), _('Send'))
00281         self.assertFalse(self.app.dialog.closed_button.isVisible())
00282         self.assertTrue(self.app.dialog.cancel_button.isVisible())
00283         self.assertTrue(self.app.dialog.treeview.isVisible())

Bug report for installed package

Definition at line 447 of file test_ui_kde.py.

00447 
00448     def test_bug_report_installed_package(self):
00449         '''Bug report for installed package'''
00450 
00451         self.app.report_file = None
00452         self.app.options.package = 'bash'
00453 
00454         def c(*args):
00455             if self.app.dialog and self.app.dialog.cancel_button.isVisible():
00456                 self.app.dialog.cancel_button.click()
00457                 return
00458             # try again
00459             QTimer.singleShot(1000, c)
00460 
00461         QTimer.singleShot(1000, c)
00462         self.app.run_report_bug()
00463 
00464         self.assertEqual(self.app.report['ProblemType'], 'Bug')
00465         self.assertEqual(self.app.report['SourcePackage'], 'bash')
00466         self.assertTrue(self.app.report['Package'].startswith('bash '))
00467         self.assertNotEqual(self.app.report['Dependencies'], '')

Bug report for uninstalled package

Definition at line 468 of file test_ui_kde.py.

00468 
00469     def test_bug_report_uninstalled_package(self):
00470         '''Bug report for uninstalled package'''
00471 
00472         pkg = apport.packaging.get_uninstalled_package()
00473 
00474         self.app.report_file = None
00475         self.app.options.package = pkg
00476 
00477         def c(*args):
00478             if self.app.dialog and self.app.dialog.cancel_button.isVisible():
00479                 self.app.dialog.cancel_button.click()
00480                 return
00481             # try again
00482             QTimer.singleShot(1000, c)
00483 
00484         QTimer.singleShot(1000, c)
00485         self.app.run_report_bug()
00486 
00487         self.assertEqual(self.app.report['ProblemType'], 'Bug')
00488         self.assertEqual(self.app.report['SourcePackage'],
00489                          apport.packaging.get_source(pkg))
00490         self.assertEqual(self.app.report['Package'], '%s (not installed)' % pkg)

Clicking the close button on the window does not report the crash.

Definition at line 82 of file test_ui_kde.py.

00082 
00083     def test_close_button(self):
00084         '''Clicking the close button on the window does not report the crash.'''
00085 
00086         def c(*args):
00087             self.app.dialog.reject()
00088         QTimer.singleShot(0, c)
00089         result = self.app.ui_present_report_details(True)
00090         self.assertFalse(result['report'])

+-----------------------------------------------------------------+
| [ logo ] YourDistro has experienced an internal error.          |
|                                                                 |
|            [x] Send an error report to help fix this problem.   |
|                                                                 |
| [ Show Details ]                                   [ Continue ] |
+-----------------------------------------------------------------+

Definition at line 91 of file test_ui_kde.py.

00091 
00092     def test_kernel_crash_layout(self):
00093         '''
00094         +-----------------------------------------------------------------+
00095         | [ logo ] YourDistro has experienced an internal error.          |
00096         |                                                                 |
00097         |            [x] Send an error report to help fix this problem.   |
00098         |                                                                 |
00099         | [ Show Details ]                                   [ Continue ] |
00100         +-----------------------------------------------------------------+
00101         '''
00102         self.app.report['ProblemType'] = 'KernelCrash'
00103         QTimer.singleShot(0, QCoreApplication.quit)
00104         self.app.ui_present_report_details(True)
00105         self.assertEqual(self.app.dialog.windowTitle(), self.distro.split()[0])
00106         self.assertEqual(self.app.dialog.heading.text(),
00107                          _('Sorry, %s has experienced an internal error.') % self.distro)
00108         self.assertTrue(self.app.dialog.send_error_report.isVisible())
00109         self.assertTrue(self.app.dialog.send_error_report.isChecked())
00110         self.assertTrue(self.app.dialog.details.isVisible())
00111         self.assertTrue(self.app.dialog.continue_button.isVisible())
00112         self.assertEqual(self.app.dialog.continue_button.text(), _('Continue'))
00113         self.assertFalse(self.app.dialog.closed_button.isVisible())
00114         self.assertFalse(self.app.dialog.text.isVisible())

+-----------------------------------------------------------------+
| [ error  ] Sorry, a problem occurred while installing software. |
|            Package: apport 1.2.3~0ubuntu1                       |
|                                                                 |
|            [x] Send an error report to help fix this problem.   |
|                                                                 |
| [ Show Details ]                                   [ Continue ] |
+-----------------------------------------------------------------+

Definition at line 115 of file test_ui_kde.py.

00115 
00116     def test_package_crash_layout(self):
00117         '''
00118         +-----------------------------------------------------------------+
00119         | [ error  ] Sorry, a problem occurred while installing software. |
00120         |            Package: apport 1.2.3~0ubuntu1                       |
00121         |                                                                 |
00122         |            [x] Send an error report to help fix this problem.   |
00123         |                                                                 |
00124         | [ Show Details ]                                   [ Continue ] |
00125         +-----------------------------------------------------------------+
00126         '''
00127         self.app.report['ProblemType'] = 'Package'
00128         self.app.report['Package'] = 'apport 1.2.3~0ubuntu1'
00129         QTimer.singleShot(0, QCoreApplication.quit)
00130         self.app.ui_present_report_details(True)
00131         self.assertEqual(self.app.dialog.windowTitle(), self.distro.split()[0])
00132         self.assertEqual(self.app.dialog.heading.text(),
00133                          _('Sorry, a problem occurred while installing software.'))
00134         self.assertTrue(self.app.dialog.send_error_report.isVisible())
00135         self.assertTrue(self.app.dialog.send_error_report.isChecked())
00136         self.assertTrue(self.app.dialog.details.isVisible())
00137         self.assertTrue(self.app.dialog.continue_button.isVisible())
00138         self.assertEqual(self.app.dialog.continue_button.text(), _('Continue'))
00139         self.assertFalse(self.app.dialog.closed_button.isVisible())
00140         self.assertEqual(self.app.dialog.text.text(),
00141                          _('Package: apport 1.2.3~0ubuntu1'))

+-----------------------------------------------------------------+
| [ logo ] The application Foo has experienced an internal error. |
|          Developer-specified error text.                        |
|                                                                 |
|            [x] Send an error report to help fix this problem.   |
|                                                                 |
| [ Show Details ]                                   [ Continue ] |
+-----------------------------------------------------------------+

Definition at line 284 of file test_ui_kde.py.

00284 
00285     def test_recoverable_crash_layout(self):
00286         '''
00287         +-----------------------------------------------------------------+
00288         | [ logo ] The application Foo has experienced an internal error. |
00289         |          Developer-specified error text.                        |
00290         |                                                                 |
00291         |            [x] Send an error report to help fix this problem.   |
00292         |                                                                 |
00293         | [ Show Details ]                                   [ Continue ] |
00294         +-----------------------------------------------------------------+
00295         '''
00296         self.app.report['ProblemType'] = 'RecoverableProblem'
00297         self.app.report['Package'] = 'apport 1.2.3~0ubuntu1'
00298         self.app.report['DialogBody'] = 'Some developer-specified error text.'
00299 
00300         with tempfile.NamedTemporaryFile() as fp:
00301             fp.write(b'''[Desktop Entry]
00302 Version=1.0
00303 Name=Apport
00304 Type=Application''')
00305             fp.flush()
00306             self.app.report['DesktopFile'] = fp.name
00307             QTimer.singleShot(0, QCoreApplication.quit)
00308             self.app.ui_present_report_details(True)
00309         self.assertEqual(self.app.dialog.windowTitle(),
00310                          self.distro.split()[0])
00311         msg = 'The application Apport has experienced an internal error.'
00312         self.assertEqual(self.app.dialog.heading.text(), msg)
00313         msg = 'Some developer-specified error text.'
00314         self.assertEqual(self.app.dialog.text.text(), msg)
00315         self.assertTrue(self.app.dialog.text.isVisible())
00316         self.assertTrue(self.app.dialog.send_error_report.isVisible())
00317         self.assertTrue(self.app.dialog.send_error_report.isChecked())
00318         self.assertTrue(self.app.dialog.details.isVisible())
00319         self.assertTrue(self.app.dialog.continue_button.isVisible())
00320         self.assertEqual(self.app.dialog.continue_button.text(), _('Continue'))
00321         self.assertFalse(self.app.dialog.closed_button.isVisible())

+-----------------------------------------------------------------+
| [ apport ] The application Apport has closed unexpectedly.      |
|                                                                 |
|            [x] Send an error report to help fix this problem.   |
|            [ ] Ignore future problems of this program version.  |
|                                                                 |
| [ Show Details ]                                   [ Continue ] |
+-----------------------------------------------------------------+

Definition at line 142 of file test_ui_kde.py.

00142 
00143     def test_regular_crash_layout(self):
00144         '''
00145         +-----------------------------------------------------------------+
00146         | [ apport ] The application Apport has closed unexpectedly.      |
00147         |                                                                 |
00148         |            [x] Send an error report to help fix this problem.   |
00149         |            [ ] Ignore future problems of this program version.  |
00150         |                                                                 |
00151         | [ Show Details ]                                   [ Continue ] |
00152         +-----------------------------------------------------------------+
00153         '''
00154         self.app.report['ProblemType'] = 'Crash'
00155         self.app.report['CrashCounter'] = '1'
00156         self.app.report['Package'] = 'apport 1.2.3~0ubuntu1'
00157         with tempfile.NamedTemporaryFile() as fp:
00158             fp.write(b'''[Desktop Entry]
00159 Version=1.0
00160 Name=Apport
00161 Type=Application''')
00162             fp.flush()
00163             self.app.report['DesktopFile'] = fp.name
00164             QTimer.singleShot(0, QCoreApplication.quit)
00165             self.app.ui_present_report_details(True)
00166         self.assertEqual(self.app.dialog.windowTitle(), self.distro.split()[0])
00167         self.assertEqual(self.app.dialog.heading.text(),
00168                          _('The application Apport has closed unexpectedly.'))
00169         self.assertTrue(self.app.dialog.send_error_report.isVisible())
00170         self.assertTrue(self.app.dialog.send_error_report.isChecked())
00171         self.assertTrue(self.app.dialog.details.isVisible())
00172         # no ProcCmdline, cannot restart
00173         self.assertTrue(self.app.dialog.continue_button.isVisible())
00174         self.assertEqual(self.app.dialog.continue_button.text(), _('Continue'))
00175         self.assertFalse(self.app.dialog.closed_button.isVisible())
00176         self.assertFalse(self.app.dialog.text.isVisible())
00177         self.assertFalse(self.app.dialog.text.isVisible())
00178         self.assertTrue(self.app.dialog.ignore_future_problems.isVisible())
00179         self.assertTrue(str(self.app.dialog.ignore_future_problems.text()).endswith(
00180             'of this program version'))

+-----------------------------------------------------------------+
| [ apport ] The application Apport has closed unexpectedly.      |
|                                                                 |
|            [x] Send an error report to help fix this problem.   |
|            [ ] Ignore future problems of this program version.  |
|                                                                 |
| [ Show Details ]                 [ Leave Closed ]  [ Relaunch ] |
+-----------------------------------------------------------------+

Definition at line 181 of file test_ui_kde.py.

00181 
00182     def test_regular_crash_layout_restart(self):
00183         '''
00184         +-----------------------------------------------------------------+
00185         | [ apport ] The application Apport has closed unexpectedly.      |
00186         |                                                                 |
00187         |            [x] Send an error report to help fix this problem.   |
00188         |            [ ] Ignore future problems of this program version.  |
00189         |                                                                 |
00190         | [ Show Details ]                 [ Leave Closed ]  [ Relaunch ] |
00191         +-----------------------------------------------------------------+
00192         '''
00193         self.app.report['ProblemType'] = 'Crash'
00194         self.app.report['CrashCounter'] = '1'
00195         self.app.report['ProcCmdline'] = 'apport-bug apport'
00196         self.app.report['Package'] = 'apport 1.2.3~0ubuntu1'
00197         with tempfile.NamedTemporaryFile() as fp:
00198             fp.write(b'''[Desktop Entry]
00199 Version=1.0
00200 Name=Apport
00201 Type=Application''')
00202             fp.flush()
00203             self.app.report['DesktopFile'] = fp.name
00204             QTimer.singleShot(0, QCoreApplication.quit)
00205             self.app.ui_present_report_details(True)
00206         self.assertEqual(self.app.dialog.windowTitle(),
00207                          self.distro.split()[0])
00208         self.assertEqual(self.app.dialog.heading.text(),
00209                          _('The application Apport has closed unexpectedly.'))
00210         self.assertTrue(self.app.dialog.send_error_report.isVisible())
00211         self.assertTrue(self.app.dialog.send_error_report.isChecked())
00212         self.assertTrue(self.app.dialog.details.isVisible())
00213         self.assertTrue(self.app.dialog.continue_button.isVisible())
00214         self.assertEqual(self.app.dialog.continue_button.text(), _('Relaunch'))
00215         self.assertTrue(self.app.dialog.closed_button.isVisible())
00216         self.assertFalse(self.app.dialog.text.isVisible())
00217         self.assertFalse(self.app.dialog.text.isVisible())
00218         self.assertTrue(self.app.dialog.ignore_future_problems.isVisible())
00219         self.assertTrue(str(self.app.dialog.ignore_future_problems.text()).endswith(
00220             'of this program version'))

+-----------------------------------------------------------------+
| [ logo ] Sorry, YourDistro has experienced an internal error.   |
|            If you notice further problems, try restarting the   |
|            computer                                             |
|                                                                 |
|            [x] Send an error report to help fix this problem.   |
|            [ ] Ignore future problems of this type.             |
|                                                                 |
| [ Show Details ]                                   [ Continue ] |
+-----------------------------------------------------------------+

Definition at line 221 of file test_ui_kde.py.

00221 
00222     def test_system_crash_layout(self):
00223         '''
00224         +-----------------------------------------------------------------+
00225         | [ logo ] Sorry, YourDistro has experienced an internal error.   |
00226         |            If you notice further problems, try restarting the   |
00227         |            computer                                             |
00228         |                                                                 |
00229         |            [x] Send an error report to help fix this problem.   |
00230         |            [ ] Ignore future problems of this type.             |
00231         |                                                                 |
00232         | [ Show Details ]                                   [ Continue ] |
00233         +-----------------------------------------------------------------+
00234         '''
00235         self.app.report['ProblemType'] = 'Crash'
00236         self.app.report['CrashCounter'] = '1'
00237         self.app.report['Package'] = 'apport 1.2.3~0ubuntu1'
00238         QTimer.singleShot(0, QCoreApplication.quit)
00239         self.app.ui_present_report_details(True)
00240         self.assertEqual(self.app.dialog.windowTitle(), self.distro.split()[0])
00241         self.assertEqual(self.app.dialog.heading.text(),
00242                          _('Sorry, %s has experienced an internal error.') % self.distro)
00243         self.assertEqual(self.app.dialog.text.text(),
00244                          _('If you notice further problems, try restarting the computer.'))
00245         self.assertTrue(self.app.dialog.text.isVisible())
00246         self.assertTrue(self.app.dialog.send_error_report.isVisible())
00247         self.assertTrue(self.app.dialog.send_error_report.isChecked())
00248         self.assertTrue(self.app.dialog.details.isVisible())
00249         self.assertTrue(self.app.dialog.continue_button.isVisible())
00250         self.assertEqual(self.app.dialog.continue_button.text(), _('Continue'))
00251         self.assertFalse(self.app.dialog.closed_button.isVisible())
00252         self.assertTrue(self.app.dialog.ignore_future_problems.isVisible())
00253         self.assertTrue(str(self.app.dialog.ignore_future_problems.text()).endswith(
00254             'of this type'))


Member Data Documentation

Definition at line 52 of file test_ui_kde.py.

Definition at line 59 of file test_ui_kde.py.

Definition at line 46 of file test_ui_kde.py.

Definition at line 326 of file test_ui_kde.py.


The documentation for this class was generated from the following file: