From 1f41801a9355ed55e50ca6f54411565a5b11b093 Mon Sep 17 00:00:00 2001 From: rafael lisboa Date: Wed, 10 Jun 2015 17:01:37 -0300 Subject: Fix bug when not passing leap certificate nor fingerprint --- service/pixelated/bitmask_libraries/certs.py | 2 +- service/test/unit/bitmask_libraries/test_certs.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/service/pixelated/bitmask_libraries/certs.py b/service/pixelated/bitmask_libraries/certs.py index 874ab246..9d543672 100644 --- a/service/pixelated/bitmask_libraries/certs.py +++ b/service/pixelated/bitmask_libraries/certs.py @@ -29,7 +29,7 @@ class LeapCertificate(object): @staticmethod def set_cert_and_fingerprint(cert_file=None, cert_fingerprint=None): if cert_fingerprint is None: - LeapCertificate.LEAP_CERT = str(cert_file) or True + LeapCertificate.LEAP_CERT = str(cert_file) if cert_file else True LeapCertificate.LEAP_FINGERPRINT = None else: LeapCertificate.LEAP_FINGERPRINT = cert_fingerprint diff --git a/service/test/unit/bitmask_libraries/test_certs.py b/service/test/unit/bitmask_libraries/test_certs.py index f1e643c4..5d447537 100644 --- a/service/test/unit/bitmask_libraries/test_certs.py +++ b/service/test/unit/bitmask_libraries/test_certs.py @@ -1,7 +1,7 @@ import unittest from pixelated.bitmask_libraries.certs import LeapCertificate -from mock import MagicMock, patch +from mock import MagicMock class CertsTest(unittest.TestCase): @@ -26,6 +26,14 @@ class CertsTest(unittest.TestCase): self.assertEqual('fingerprint', LeapCertificate.LEAP_FINGERPRINT) self.assertFalse(certs.provider_web_cert) + def test_set_cert_and_fingerprint_when_none_are_passed(self): + LeapCertificate.set_cert_and_fingerprint(None, None) + + certs = LeapCertificate(self.provider) + + self.assertIsNone(certs.LEAP_FINGERPRINT) + self.assertEqual(True, certs.provider_web_cert) + def test_provider_api_cert(self): certs = LeapCertificate(self.provider).provider_api_cert -- cgit v1.2.3