Imported Debian patch 4.0.5-6~numeezy
This commit is contained in:
committed by
Mario Fetka
parent
c44de33144
commit
10dfc9587b
@@ -25,21 +25,16 @@ import os
|
||||
import shutil
|
||||
from nose.tools import raises, assert_raises # pylint: disable=E0611
|
||||
|
||||
from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test, assert_attr_equal
|
||||
from xmlrpc_test import XMLRPC_test, assert_attr_equal
|
||||
from ipalib import api
|
||||
from ipalib import errors
|
||||
from ipalib import x509
|
||||
import tempfile
|
||||
from ipapython import ipautil
|
||||
import six
|
||||
import nose
|
||||
import base64
|
||||
from ipaplatform.paths import paths
|
||||
from ipapython.dn import DN
|
||||
import pytest
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
# So we can save the cert from issuance and compare it later
|
||||
cert = None
|
||||
@@ -72,13 +67,11 @@ def is_db_configured():
|
||||
# The API tested depends on the value of ~/.ipa/default/ra_plugin when
|
||||
# running as the lite-server.
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_cert(XMLRPC_test):
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
super(test_cert, cls).setup_class()
|
||||
def setUpClass(cls):
|
||||
super(test_cert, cls).setUpClass()
|
||||
|
||||
if 'cert_request' not in api.Command:
|
||||
raise nose.SkipTest('cert_request not registered')
|
||||
@@ -90,7 +83,8 @@ class test_cert(XMLRPC_test):
|
||||
new_args = new_args + args
|
||||
return ipautil.run(new_args, stdin)
|
||||
|
||||
def setup(self):
|
||||
def setUp(self):
|
||||
super(test_cert, self).setUp()
|
||||
self.reqdir = tempfile.mkdtemp(prefix = "tmp-")
|
||||
self.reqfile = self.reqdir + "/test.csr"
|
||||
self.pwname = self.reqdir + "/pwd"
|
||||
@@ -105,7 +99,8 @@ class test_cert(XMLRPC_test):
|
||||
|
||||
self.subject = DN(('CN', self.host_fqdn), x509.subject_base())
|
||||
|
||||
def teardown(self):
|
||||
def tearDown(self):
|
||||
super(test_cert, self).tearDown()
|
||||
shutil.rmtree(self.reqdir, ignore_errors=True)
|
||||
|
||||
def generateCSR(self, subject):
|
||||
@@ -190,10 +185,10 @@ class test_cert(XMLRPC_test):
|
||||
global cert, newcert
|
||||
|
||||
res = api.Command['service_show'](self.service_princ)['result']
|
||||
|
||||
# Both the old and the new certs should be listed as certificates now
|
||||
certs_encoded = (base64.b64encode(cert) for cert in res['usercertificate'])
|
||||
assert set(certs_encoded) == set([cert, newcert])
|
||||
# It should no longer match our old cert
|
||||
assert base64.b64encode(res['usercertificate'][0]) != cert
|
||||
# And it should match the new one
|
||||
assert base64.b64encode(res['usercertificate'][0]) == newcert
|
||||
|
||||
def test_0007_cleanup(self):
|
||||
"""
|
||||
@@ -206,13 +201,11 @@ class test_cert(XMLRPC_test):
|
||||
res = api.Command['service_find'](self.service_princ)
|
||||
assert res['count'] == 0
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_cert_find(XMLRPC_test):
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
super(test_cert_find, cls).setup_class()
|
||||
def setUpClass(cls):
|
||||
super(test_cert_find, cls).setUpClass()
|
||||
|
||||
if 'cert_find' not in api.Command:
|
||||
raise nose.SkipTest('cert_find not registered')
|
||||
@@ -225,7 +218,7 @@ class test_cert_find(XMLRPC_test):
|
||||
"""
|
||||
Test the `cert-find` command.
|
||||
"""
|
||||
short = api.env.host.split('.')[0]
|
||||
short = api.env.host.replace('.' + api.env.domain, '')
|
||||
|
||||
def test_0001_find_all(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user