def test_parse(self): pem = Pem(self.pem_contents) self.assertEqual(pem.private_key, self.private_key) self.assertEqual(pem.certificate, self.certificate) with self.assertRaises(KeyError): pem.csr with self.assertRaises(KeyError): pem.get("FOO BAR")
def test_parse_custom_content(self): pem = Pem(trim("""Hi, please take this. -----BEGIN FOOBAR----- HELLO/WORKD=== -----END FOOBAR----- regards, kind of mail signature comes here """) + "\n") self.assertEqual( trim(pem.get("FOOBAR")), trim("""-----BEGIN FOOBAR----- HELLO/WORKD=== -----END FOOBAR-----"""))