From 4b7e81fbbe5ae0b0b4178f1a8ff5544346339ce1 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Wed, 15 May 2019 13:38:50 +0200 Subject: [PATCH] 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 Reviewed-By: Alexander Bokovoy --- ipatests/test_integration/test_commands.py | 9 +++++---- ipatests/test_integration/test_external_ca.py | 12 +++++++----- ipatests/test_integration/test_uninstallation.py | 6 ++++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py index 30c894884..6125a63a1 100644 --- a/ipatests/test_integration/test_commands.py +++ b/ipatests/test_integration/test_commands.py @@ -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): """ diff --git a/ipatests/test_integration/test_external_ca.py b/ipatests/test_integration/test_external_ca.py index 22c59098c..83bba7c59 100644 --- a/ipatests/test_integration/test_external_ca.py +++ b/ipatests/test_integration/test_external_ca.py @@ -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( diff --git a/ipatests/test_integration/test_uninstallation.py b/ipatests/test_integration/test_uninstallation.py index 9d8cb1cc0..a5cee1428 100644 --- a/ipatests/test_integration/test_uninstallation.py +++ b/ipatests/test_integration/test_uninstallation.py @@ -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