1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-15 08:36:13 +01:00
github.com_openSUSE_osc/tests/test_keyinfo.py

44 lines
927 B
Python
Raw Normal View History

import unittest
from osc import obs_api
class TestKeyinfo(unittest.TestCase):
def test_empty_pubkey(self):
ki = obs_api.Keyinfo()
ki.pubkey_list = [{"value": "<pubkey>"}]
expected = """
Type : GPG public key
User ID :
Algorithm :
Key size :
Expires :
Fingerprint :
<pubkey>""".strip()
actual = ki.pubkey_list[0].to_human_readable_string()
self.assertEqual(expected, actual)
def test_empty_sslcert(self):
ki = obs_api.Keyinfo()
ki.sslcert_list = [{"value": "<pubkey>"}]
expected = """
Type : SSL certificate
Subject :
Key ID :
Serial :
Issuer :
Algorithm :
Key size :
Begins :
Expires :
Fingerprint :
<pubkey>""".strip()
actual = ki.sslcert_list[0].to_human_readable_string()
self.assertEqual(expected, actual)
if __name__ == "__main__":
unittest.main()