1 from gnome import gconf
2 from wifi_assistant.gui.about_dialog import AboutDialog
7 class AboutDialogTest(unittest.TestCase):
10 self.launcher = Mock()
11 self.launcher.replay()
12 self.testee = AboutDialog(self.launcher, None)
15 def test_bugButtonCallsLauncher(self):
16 self._makeRunDialogReturn(AboutDialog.BUG_BUTTON)
18 verify(self.launcher).openUrl(AboutDialog.BUG_URL)
21 def test_closeButtonDoesntCallLauncher(self):
22 self._makeRunDialogReturn(AboutDialog.CLOSE_BUTTON)
24 verify(self.launcher, never()).openUrl()
27 def test_donateButtonCallsLauncher(self):
28 self._makeRunDialogReturn(AboutDialog.DONATE_BUTTON)
30 verify(self.launcher).openUrl(AboutDialog.DONATE_URL)
33 def test_bug_11199_dialogTitleContainsVersion(self):
34 class checkVersionOnShow():
35 def __init__(self, version):
36 self.version = version
37 def __call__(self, dialog):
38 assert self.version in dialog.get_title()
40 self.testee._runDialog = checkVersionOnShow(AboutDialog.VERSION)
44 def _makeRunDialogReturn(self, value):
46 def __init__(self, testee, value_to_return):
47 self._value_to_return = value_to_return
50 def __call__(self, dialog):
51 self._testee._responseCallback(dialog, self._value_to_return)
53 self.testee._runDialog = method(self.testee, value)
56 if __name__ == '__main__':