summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-12-06 01:29:53 +0900
committerkali <kali@leap.se>2012-12-12 04:27:51 +0900
commitcb4c40c21cf19e8b61a7747067e4b9729209d4b0 (patch)
tree68d1f683d8b59dbb595c317becba73c6f7750882
parent52aa909c23bff688e2a164dca546e4a493e72fe4 (diff)
providerselect tests
-rw-r--r--src/leap/gui/tests/test_firstrun_providerselect.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/leap/gui/tests/test_firstrun_providerselect.py b/src/leap/gui/tests/test_firstrun_providerselect.py
new file mode 100644
index 00000000..be7cc9c1
--- /dev/null
+++ b/src/leap/gui/tests/test_firstrun_providerselect.py
@@ -0,0 +1,61 @@
+import sys
+import unittest
+
+import mock
+
+from leap.testing import qunittest
+from leap.testing import pyqt
+
+from PyQt4 import QtGui
+#from PyQt4 import QtCore
+import PyQt4.QtCore # some weirdness with mock module
+
+from PyQt4.QtTest import QTest
+#from PyQt4.QtCore import Qt
+
+from leap.gui import firstrun
+
+
+class TestPage(firstrun.providerselect.SelectProviderPage):
+ pass
+
+
+class SelectProviderPageTestCase(qunittest.TestCase):
+
+ # XXX can spy on signal connections
+
+ def setUp(self):
+ self.app = QtGui.QApplication(sys.argv)
+ QtGui.qApp = self.app
+ self.page = TestPage(None)
+ self.page.wizard = mock.MagicMock()
+ self.page.wizard().netchecker.return_value = True
+
+ def tearDown(self):
+ QtGui.qApp = None
+ self.app = None
+ self.page = None
+
+ def test__do_checks(self):
+ eq = self.assertEqual
+ checks = [x for x in self.page._do_checks()]
+ eq(len(checks), 5)
+ labels = [str(x) for (x, y), z in checks]
+ eq(labels, ['head_sentinel', 'checking domain name',
+ 'checking https connection',
+ 'fetching provider info', 'end_sentinel'])
+ progress = [y for (x, y), z in checks]
+ eq(progress, [0, 20, 40, 80, 100])
+
+ # XXX now: execute the functions
+ # with proper mocks (for checkers and so on)
+ # and try to cover all the exceptions
+ checkfuns = [z for (x, y), z in checks]
+ #import ipdb;ipdb.set_trace()
+
+ def test_next_button_is_disabled(self):
+ pass
+
+
+if __name__ == "__main__":
+ unittest.main()