Replace imports from ipaserver

The ipatests/test_integration/ package only uses ipaserver in a few
places. Copy some simple constants to decouple the packages.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Christian Heimes committed 2019-05-16 13:20:38 +02:00
1 parent 289f9c7e25
commit 4b7e81fbbe
3 files changed
+16 -11

No files matched your search

+5 -4
View File
@@ -25,10 +25,6 @@ from ipaplatform.paths import paths
from ipapython.dn import DN
from ipaserver.masters import (
CONFIGURED_SERVICE, ENABLED_SERVICE, HIDDEN_SERVICE
)
from ipatests.test_integration.base import IntegrationTest
from ipatests.pytest_ipa.integration import tasks
from ipatests.create_external_ca import ExternalCA
@@ -36,6 +32,11 @@ from ipatests.test_ipalib.test_x509 import good_pkcs7, badcert
logger = logging.getLogger(__name__)
# from ipaserver.masters
CONFIGURED_SERVICE = u'configuredService'
ENABLED_SERVICE = u'enabledService'
HIDDEN_SERVICE = u'hiddenService'
class TestIPACommand(IntegrationTest):
"""
@@ -31,7 +31,6 @@ from ipaplatform.paths import paths
from itertools import chain, repeat
from ipatests.create_external_ca import ExternalCA, ISSUER_CN
from ipaserver.install.cainstance import MSCSTemplateV1
IPA_CA = 'ipa_ca.crt'
ROOT_CA = 'root_ca.crt'
@@ -107,14 +106,14 @@ def check_ipaca_issuerDN(host, expected_dn):
assert "Issuer DN: {}".format(expected_dn) in result.stdout_text
def check_mscs_extension(ipa_csr, template):
def check_mscs_extension(ipa_csr, oid, value):
csr = x509.load_pem_x509_csr(ipa_csr, default_backend())
extensions = [
ext for ext in csr.extensions
if ext.oid.dotted_string == template.ext_oid
if ext.oid.dotted_string == oid
]
assert extensions
assert extensions[0].value.value == template.get_ext_data()
assert extensions[0].value.value == value
class TestExternalCA(IntegrationTest):
@@ -133,7 +132,10 @@ class TestExternalCA(IntegrationTest):
# check CSR for extension
ipa_csr = self.master.get_file_contents(paths.ROOT_IPA_CSR)
check_mscs_extension(ipa_csr, MSCSTemplateV1(u'SubCA'))
# Values for MSCSTemplateV1('SubCA')
oid = "1.3.6.1.4.1.311.20.2"
value = b'\x1e\n\x00S\x00u\x00b\x00C\x00A'
check_mscs_extension(ipa_csr, oid, value)
# Sign CA, transport it to the host and get ipa a root ca paths.
root_ca_fname, ipa_ca_fname = tasks.sign_ca_and_transport(
@@ -17,9 +17,11 @@ import os
from ipatests.test_integration.base import IntegrationTest
from ipatests.pytest_ipa.integration import tasks
from ipaplatform.paths import paths
from ipaserver.install import dsinstance
from ipapython.ipaldap import realm_to_serverid
# from ipaserver.install.dsinstance
DS_INSTANCE_PREFIX = 'slapd-'
class TestUninstallBase(IntegrationTest):
@@ -65,7 +67,7 @@ class TestUninstallBase(IntegrationTest):
self.master.run_command(['ipactl', 'stop'])
serverid = realm_to_serverid(self.master.domain.realm)
instance_name = ''.join([dsinstance.DS_INSTANCE_PREFIX, serverid])
instance_name = ''.join([DS_INSTANCE_PREFIX, serverid])
try:
# Moving the DS instance out of the way will cause the