Commit 876b9b0b authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

tests: Extend test coverage for pgp_key_link

Add tests for providing an int/long to pgp_key_link with various sizes:
8, 16 or 40 chars.
parent bdc563d8
......@@ -31,6 +31,11 @@ def test_format_key(self):
pgp_key_len = len(pgp_key) + len('0x')
self.assertEqual(pgp_key_len, len(format_key(pgp_key)))
def assert_pgp_key_link(self, pgp_key):
output = pgp_key_link(int(pgp_key, 16))
self.assertIn(pgp_key[2:], output)
self.assertIn("https", output)
def test_pgp_key_link(self):
self.assertEqual(pgp_key_link(""), "Unknown")
......@@ -43,6 +48,15 @@ def test_pgp_key_link(self):
self.assertIn("test", output)
self.assertIn("https", output)
# Numeric key_id <= 8
self.assert_pgp_key_link('0x0023BDC7')
# Numeric key_id <= 16
self.assert_pgp_key_link('0xBDC7FF5E34A12F')
# Numeric key_id <= 40
self.assert_pgp_key_link('0xA10E234343EA8BDC7FF5E34A12F')
pgp_key = '423423fD9004FB063E2C81117BFB1108D234DAFZ'
server = getattr(settings, 'PGP_SERVER')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment