class DsgManagementToolsDialogTest(unittest.TestCase):
    """Test dialog works."""

    def setUp(self):
        """Runs before each test."""
        self.dialog = DsgManagementToolsDialog(None)

    def tearDown(self):
        """Runs after each test."""
        self.dialog = None

    def test_dialog_ok(self):
        """Test we can click OK."""

        button = self.dialog.button_box.button(QDialogButtonBox.Ok)
        button.click()
        result = self.dialog.result()
        self.assertEqual(result, QDialog.Accepted)

    def test_dialog_cancel(self):
        """Test we can click cancel."""
        button = self.dialog.button_box.button(QDialogButtonBox.Cancel)
        button.click()
        result = self.dialog.result()
        self.assertEqual(result, QDialog.Rejected)
 def run(self):
     """Run method that performs all the real work"""
     # Create the dialog (after translation) and keep reference
     dlg = DsgManagementToolsDialog()
     # show the dialog
     dlg.show()
     # Run the dialog event loop
     result = dlg.exec_()
     # See if OK was pressed
     if result:
         # Do something useful here - delete the line containing pass and
         # substitute with your code.
         pass
 def setUp(self):
     """Runs before each test."""
     self.dialog = DsgManagementToolsDialog(None)