summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-07-12 17:15:58 -0400
committerRob Crittenden <rcritten@redhat.com>2010-07-13 09:28:03 -0400
commitc9e0b43d53eaf6def7d8f445734115450f8fecaf (patch)
treefa30dab5ad23363c75e8ae5b77d10f2d9c283e8f /tests
parent2bb2850fff0224f87109ba4a525213f9d675911e (diff)
downloadfreeipa-c9e0b43d53eaf6def7d8f445734115450f8fecaf.tar.gz
freeipa-c9e0b43d53eaf6def7d8f445734115450f8fecaf.tar.xz
freeipa-c9e0b43d53eaf6def7d8f445734115450f8fecaf.zip
Add test to ensure that a certificate we issue is actually stored properly.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_cert.py34
1 files changed, 32 insertions, 2 deletions
diff --git a/tests/test_xmlrpc/test_cert.py b/tests/test_xmlrpc/test_cert.py
index fd3db5939..a99848152 100644
--- a/tests/test_xmlrpc/test_cert.py
+++ b/tests/test_xmlrpc/test_cert.py
@@ -29,6 +29,10 @@ from ipalib import errors
import tempfile
from ipapython import ipautil
import nose
+import base64
+
+# So we can save the cert from issuance and compare it later
+cert = None
# Test setup
#
@@ -110,14 +114,40 @@ class test_cert(XMLRPC_test):
Test the `xmlrpc.cert_request` method with --add.
"""
# Our host should exist from previous test
+ global cert
csr = unicode(self.generateCSR(self.subject))
res = api.Command['cert_request'](csr, principal=self.service_princ, add=True)['result']
assert res['subject'] == self.subject
+ # save the cert for the service_show/find tests
+ cert = res['certificate']
+
+ def test_3_service_show(self):
+ """
+ Verify that service-show has the right certificate.
+ """
+ global cert
+
+ res = api.Command['service_show'](self.service_princ)['result']
+ assert base64.b64encode(res['usercertificate'][0]) == cert
+ def test_4_service_find(self):
+ """
+ Verify that service-find has the right certificate.
+ """
+ global cert
+
+ # Assume there is only one service
+ res = api.Command['service_find'](self.service_princ)['result']
+ assert base64.b64encode(res[0]['usercertificate'][0]) == cert
- def test_3_cleanup(self):
+ def test_5_cleanup(self):
+ """
+ Clean up cert test data
+ """
# Now clean things up
api.Command['host_del'](self.host_fqdn)
- assert(True)
+ # Verify that the service is gone
+ res = api.Command['service_find'](self.service_princ)
+ assert res['count'] == 0