mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add tests for ipa-cacert-manage install
Some basic tests like re-loading a certificate, loading a PKCS#7 cert and bad cert handling. Signed-off-by: Rob Crittenden <rcritten@redhat.com> https://pagure.io/freeipa/issue/7579 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
committed by
Christian Heimes
parent
87474cc1a3
commit
3e8f550c29
@@ -27,6 +27,7 @@ from ipaplatform.paths import paths
|
|||||||
from ipatests.test_integration.base import IntegrationTest
|
from ipatests.test_integration.base import IntegrationTest
|
||||||
from ipatests.pytest_ipa.integration import tasks
|
from ipatests.pytest_ipa.integration import tasks
|
||||||
from ipatests.create_external_ca import ExternalCA
|
from ipatests.create_external_ca import ExternalCA
|
||||||
|
from ipatests.test_ipalib.test_x509 import good_pkcs7, badcert
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -460,3 +461,37 @@ class TestIPACommand(IntegrationTest):
|
|||||||
['sudo', '-u', IPAAPI_USER, '--'] + cmd
|
['sudo', '-u', IPAAPI_USER, '--'] + cmd
|
||||||
)
|
)
|
||||||
assert uid in result.stdout_text
|
assert uid in result.stdout_text
|
||||||
|
|
||||||
|
def test_ipa_cacert_manage_install(self):
|
||||||
|
# Re-install the IPA CA
|
||||||
|
self.master.run_command([
|
||||||
|
paths.IPA_CACERT_MANAGE,
|
||||||
|
'install',
|
||||||
|
paths.IPA_CA_CRT])
|
||||||
|
|
||||||
|
# Test a non-existent file
|
||||||
|
result = self.master.run_command([
|
||||||
|
paths.IPA_CACERT_MANAGE,
|
||||||
|
'install',
|
||||||
|
'/var/run/cert_not_found'], raiseonerr=False)
|
||||||
|
assert result.returncode == 1
|
||||||
|
|
||||||
|
cmd = self.master.run_command(['mktemp'])
|
||||||
|
filename = cmd.stdout_text.strip()
|
||||||
|
|
||||||
|
for contents in (good_pkcs7,):
|
||||||
|
self.master.put_file_contents(filename, contents)
|
||||||
|
result = self.master.run_command([
|
||||||
|
paths.IPA_CACERT_MANAGE,
|
||||||
|
'install',
|
||||||
|
filename])
|
||||||
|
|
||||||
|
for contents in (badcert,):
|
||||||
|
self.master.put_file_contents(filename, contents)
|
||||||
|
result = self.master.run_command([
|
||||||
|
paths.IPA_CACERT_MANAGE,
|
||||||
|
'install',
|
||||||
|
filename], raiseonerr=False)
|
||||||
|
assert result.returncode == 1
|
||||||
|
|
||||||
|
self.master.run_command(['rm', '-f', filename])
|
||||||
|
|||||||
Reference in New Issue
Block a user