summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/provider
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-01-15 19:18:05 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-01-16 16:53:28 -0300
commit8c71fcd6e070d6bf46394fb29fba4d75c76a3987 (patch)
tree35f9083ffdac8537b7ffd5eecec42bd895bdf033 /src/leap/bitmask/provider
parente7472ad6686e06c2bd78e9f873632b58538f05f7 (diff)
Fix failing tests.
Remove srpauth obsolete tests. Remove providerconfig obsolete test. Set as mandatory the signaler object on ProviderBootstrapper and EIPBootstrapper. Closes #6631.
Diffstat (limited to 'src/leap/bitmask/provider')
-rw-r--r--src/leap/bitmask/provider/providerbootstrapper.py41
-rw-r--r--src/leap/bitmask/provider/tests/test_providerbootstrapper.py3
2 files changed, 29 insertions, 15 deletions
diff --git a/src/leap/bitmask/provider/providerbootstrapper.py b/src/leap/bitmask/provider/providerbootstrapper.py
index 8eefb9d9..efba29f9 100644
--- a/src/leap/bitmask/provider/providerbootstrapper.py
+++ b/src/leap/bitmask/provider/providerbootstrapper.py
@@ -225,8 +225,9 @@ class ProviderBootstrapper(AbstractBootstrapper):
if flags.APP_VERSION_CHECK:
# TODO split
if not provider.supports_client(min_client_version):
- self._signaler.signal(
- self._signaler.prov_unsupported_client)
+ if self._signaler is not None:
+ self._signaler.signal(
+ self._signaler.prov_unsupported_client)
raise UnsupportedClientVersionError()
provider_definition, mtime = get_content(res)
@@ -248,7 +249,9 @@ class ProviderBootstrapper(AbstractBootstrapper):
'Found: {1}.').format(api_supported, api_version)
logger.error(error)
- self._signaler.signal(self._signaler.prov_unsupported_api)
+ if self._signaler is not None:
+ self._signaler.signal(
+ self._signaler.prov_unsupported_api)
raise UnsupportedProviderAPI(error)
def run_provider_select_checks(self, domain, download_if_needed=False):
@@ -267,12 +270,18 @@ class ProviderBootstrapper(AbstractBootstrapper):
self._domain = ProviderConfig.sanitize_path_component(domain)
self._download_if_needed = download_if_needed
+ name_resolution = None
+ https_connection = None
+ down_provider_info = None
+ if self._signaler is not None:
+ name_resolution = self._signaler.prov_name_resolution
+ https_connection = self._signaler.prov_https_connection
+ down_provider_info = self._signaler.prov_download_provider_info
+
cb_chain = [
- (self._check_name_resolution,
- self._signaler.prov_name_resolution),
- (self._check_https, self._signaler.prov_https_connection),
- (self._download_provider_info,
- self._signaler.prov_download_provider_info)
+ (self._check_name_resolution, name_resolution),
+ (self._check_https, https_connection),
+ (self._download_provider_info, down_provider_info)
]
return self.addCallbackChain(cb_chain)
@@ -398,12 +407,18 @@ class ProviderBootstrapper(AbstractBootstrapper):
self._provider_config = provider_config
self._download_if_needed = download_if_needed
+ download_ca_cert = None
+ check_ca_fingerprint = None
+ check_api_certificate = None
+ if self._signaler is not None:
+ download_ca_cert = self._signaler.prov_download_ca_cert
+ check_ca_fingerprint = self._signaler.prov_check_ca_fingerprint
+ check_api_certificate = self._signaler.prov_check_api_certificate
+
cb_chain = [
- (self._download_ca_cert, self._signaler.prov_download_ca_cert),
- (self._check_ca_fingerprint,
- self._signaler.prov_check_ca_fingerprint),
- (self._check_api_certificate,
- self._signaler.prov_check_api_certificate)
+ (self._download_ca_cert, download_ca_cert),
+ (self._check_ca_fingerprint, check_ca_fingerprint),
+ (self._check_api_certificate, check_api_certificate)
]
return self.addCallbackChain(cb_chain)
diff --git a/src/leap/bitmask/provider/tests/test_providerbootstrapper.py b/src/leap/bitmask/provider/tests/test_providerbootstrapper.py
index 6cf3e469..e694e456 100644
--- a/src/leap/bitmask/provider/tests/test_providerbootstrapper.py
+++ b/src/leap/bitmask/provider/tests/test_providerbootstrapper.py
@@ -38,7 +38,6 @@ from requests.models import Response
from leap.bitmask import provider
from leap.bitmask import util
-from leap.bitmask.backend import Signaler
from leap.bitmask.config.providerconfig import ProviderConfig
from leap.bitmask.crypto.tests import fake_provider
from leap.bitmask.provider.providerbootstrapper import ProviderBootstrapper
@@ -51,7 +50,7 @@ from leap.common.testing.https_server import where
class ProviderBootstrapperTest(BaseLeapTest):
def setUp(self):
- self.pb = ProviderBootstrapper(Signaler())
+ self.pb = ProviderBootstrapper()
def tearDown(self):
pass