summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorrafael lisboa <rafaelzlisboa@gmail.com>2015-06-10 17:01:37 -0300
committerrafael lisboa <rafaelzlisboa@gmail.com>2015-06-10 17:01:37 -0300
commit1f41801a9355ed55e50ca6f54411565a5b11b093 (patch)
tree8355d6db60b4ae16748807b0aeb29991765ba5c7 /service
parent031ebd58fd97bebae81e4e17cd7c4a4ed5a493d0 (diff)
Fix bug when not passing leap certificate nor fingerprint
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/bitmask_libraries/certs.py2
-rw-r--r--service/test/unit/bitmask_libraries/test_certs.py10
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