-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make most of the fields in KeyinfoPubkey and KeyinfoSslcert models op…
…tional 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.
- Loading branch information
Showing
3 changed files
with
67 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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() |