diff --git a/passbook/crypto/models.py b/passbook/crypto/models.py index 26f52e26c..abcbec7df 100644 --- a/passbook/crypto/models.py +++ b/passbook/crypto/models.py @@ -56,7 +56,9 @@ class CertificateKeyPair(CreatedUpdatedModel): @property def fingerprint(self) -> str: """Get SHA256 Fingerprint of certificate_data""" - return hexlify(self.certificate.fingerprint(hashes.SHA256())).decode("utf-8") + return hexlify(self.certificate.fingerprint(hashes.SHA256()), ":").decode( + "utf-8" + ) def __str__(self) -> str: return f"Certificate-Key Pair {self.name} {self.fingerprint}" diff --git a/passbook/lib/utils/http.py b/passbook/lib/utils/http.py index cb34a31aa..4c688fc05 100644 --- a/passbook/lib/utils/http.py +++ b/passbook/lib/utils/http.py @@ -23,4 +23,4 @@ def get_client_ip(request: Optional[HttpRequest]) -> Optional[str]: Returns none if no IP Could be found""" if request: return _get_client_ip_from_meta(request.META) - return "" + return None diff --git a/passbook/policies/signals.py b/passbook/policies/signals.py index 82e0b3d94..92489187f 100644 --- a/passbook/policies/signals.py +++ b/passbook/policies/signals.py @@ -14,7 +14,6 @@ def invalidate_policy_cache(sender, instance, **_): from passbook.policies.models import Policy, PolicyBinding if isinstance(instance, Policy): - LOGGER.debug("Invalidating policy cache", policy=instance) total = 0 for binding in PolicyBinding.objects.filter(policy=instance): prefix = ( @@ -23,4 +22,4 @@ def invalidate_policy_cache(sender, instance, **_): keys = cache.keys(prefix) total += len(keys) cache.delete_many(keys) - LOGGER.debug("Deleted keys", len=total) + LOGGER.debug("Invalidating policy cache", policy=instance, keys=total) diff --git a/passbook/policies/tests/test_engine.py b/passbook/policies/tests.py similarity index 99% rename from passbook/policies/tests/test_engine.py rename to passbook/policies/tests.py index 05537e432..d7aee94dd 100644 --- a/passbook/policies/tests/test_engine.py +++ b/passbook/policies/tests.py @@ -9,7 +9,7 @@ from passbook.policies.expression.models import ExpressionPolicy from passbook.policies.models import Policy, PolicyBinding, PolicyBindingModel -class PolicyTestEngine(TestCase): +class TestPolicyEngine(TestCase): """PolicyEngine tests""" def setUp(self): diff --git a/passbook/policies/tests/__init__.py b/passbook/policies/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000