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
Daniel Mach 52f076636d Make most of the fields in KeyinfoPubkey and KeyinfoSslcert models optional
The presence of the fields seems to be random and the only truly required field
is the actual public key/cert. Other fields are only for the information.
2024-07-04 14:24:52 +02:00

44 lines
927 B
Python

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()