diff options
author | kali <kali@leap.se> | 2012-11-14 00:33:05 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-11-14 00:33:05 +0900 |
commit | d24c7328fa845737dbb83d512e4b3f287634c4cc (patch) | |
tree | ae0409bd742ce3a6f994ae9bb31fc5ab7225f1c6 /src/leap/gui | |
parent | d2dcf5a1060d60c451570349a6a06ad102d6924c (diff) |
make tests pass + pep8
They were breaking mainly because I did not bother to have a pass
over them to change the PROVIDER settings from the branding case.
All good now, although much testing is yet needed and some refactor
could be used.
long live green tests!
Diffstat (limited to 'src/leap/gui')
-rw-r--r-- | src/leap/gui/__init__.py | 7 | ||||
-rw-r--r-- | src/leap/gui/firstrun/__init__.py | 9 | ||||
-rw-r--r-- | src/leap/gui/firstrun/regvalidation.py | 2 | ||||
-rwxr-xr-x | src/leap/gui/firstrun/tests/integration/fake_provider.py | 10 | ||||
-rw-r--r-- | src/leap/gui/test_mainwindow_rc.py | 9 |
5 files changed, 26 insertions, 11 deletions
diff --git a/src/leap/gui/__init__.py b/src/leap/gui/__init__.py index 6ecd665f..9b8f8746 100644 --- a/src/leap/gui/__init__.py +++ b/src/leap/gui/__init__.py @@ -1,3 +1,10 @@ +try: + import sip + sip.setapi('QString', 2) + sip.setapi('QVariant', 2) +except ValueError: + pass + import firstrun __all__ = ['firstrun'] diff --git a/src/leap/gui/firstrun/__init__.py b/src/leap/gui/firstrun/__init__.py index 477e7269..8a70d90e 100644 --- a/src/leap/gui/firstrun/__init__.py +++ b/src/leap/gui/firstrun/__init__.py @@ -1,6 +1,9 @@ -import sip -sip.setapi('QString', 2) -sip.setapi('QVariant', 2) +try: + import sip + sip.setapi('QString', 2) + sip.setapi('QVariant', 2) +except ValueError: + pass import connect import intro diff --git a/src/leap/gui/firstrun/regvalidation.py b/src/leap/gui/firstrun/regvalidation.py index 6681b953..dbe30d3c 100644 --- a/src/leap/gui/firstrun/regvalidation.py +++ b/src/leap/gui/firstrun/regvalidation.py @@ -211,8 +211,6 @@ class RegisterUserValidationPage(ValidationPage): wizard, 'start_eipconnection_signal', None) - import pdb4qt; pdb4qt.set_trace() - if conductor: conductor.set_provider_domain(domain) conductor.run_checks() diff --git a/src/leap/gui/firstrun/tests/integration/fake_provider.py b/src/leap/gui/firstrun/tests/integration/fake_provider.py index 09c6c468..33ee0ee6 100755 --- a/src/leap/gui/firstrun/tests/integration/fake_provider.py +++ b/src/leap/gui/firstrun/tests/integration/fake_provider.py @@ -12,8 +12,10 @@ and that you place the following files: [ ] provider.json [ ] eip-service.json - """ +# XXX NOTE: intended for manual debug. +# I intend to include this as a regular test after 0.2.0 release +# (so we can add twisted as a dep there) import binascii import json import os @@ -47,11 +49,13 @@ Testing the FAKE_API: ##################### 1) register an user - >> curl -d "user[login]=me" -d "user[password_salt]=foo" -d "user[password_verifier]=beef" http://localhost:8000/1/users.json + >> curl -d "user[login]=me" -d "user[password_salt]=foo" \ + -d "user[password_verifier]=beef" http://localhost:8000/1/users.json << {"errors": null} 2) check that if you try to register again, it will fail: - >> curl -d "user[login]=me" -d "user[password_salt]=foo" -d "user[password_verifier]=beef" http://localhost:8000/1/users.json + >> curl -d "user[login]=me" -d "user[password_salt]=foo" \ + -d "user[password_verifier]=beef" http://localhost:8000/1/users.json << {"errors": {"login": "already taken!"}} """ diff --git a/src/leap/gui/test_mainwindow_rc.py b/src/leap/gui/test_mainwindow_rc.py index 88ae5854..c2fb3f78 100644 --- a/src/leap/gui/test_mainwindow_rc.py +++ b/src/leap/gui/test_mainwindow_rc.py @@ -1,8 +1,11 @@ import unittest import hashlib -import sip -sip.setapi('QVariant', 2) +try: + import sip + sip.setapi('QVariant', 2) +except ValueError: + pass from leap.gui import mainwindow_rc @@ -23,4 +26,4 @@ class MainWindowResourcesTest(unittest.TestCase): def test_mainwindow_resources_hash(self): self.assertEqual( hashlib.md5(mainwindow_rc.qt_resource_data).hexdigest(), - 'd74eb99247b9d5cd2f00b2f695ca6b59') + 'cc7f55e551df55e39c7dbedc1f7de4c2') |