From faee833ef39498f9ac54ddb36fe7d3a0adce713a Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Fri, 9 Dec 2016 19:21:19 +0200 Subject: [PATCH] - Use SystemInfo to determine to OS type (instead of using the facts from the Ansbile module and the Testinfra backend module, which is just ugly code). --- tests/test_ca_store.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/test_ca_store.py b/tests/test_ca_store.py index f8d6ad5..81c21f9 100644 --- a/tests/test_ca_store.py +++ b/tests/test_ca_store.py @@ -30,18 +30,12 @@ def test_concat_cert(File, Command): 'grep BEGIN /usr/share/ca-certificates/*.crt | wc -l').stdout -def test_update_ca_certificates(File, Ansible, Command, Sudo, - TestinfraBackend): - connection = TestinfraBackend.get_connection_type() - if connection == 'docker': +def test_update_ca_certificates(File, SystemInfo, Command, Sudo): + if SystemInfo.type == 'openbsd': + filename = '/usr/local/sbin/update-ca-certificates' + elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian', + 'ubuntu']: filename = '/usr/sbin/update-ca-certificates' - elif connection == 'ansible': - ansible_os_family = Ansible('setup')['ansible_facts'][ - 'ansible_os_family'] - if ansible_os_family == 'OpenBSD': - filename = '/usr/local/sbin/update-ca-certificates' - else: - filename = '/usr/sbin/update-ca-certificates' update_ca_certificates = File(filename) assert update_ca_certificates.is_file assert update_ca_certificates.mode == 0o0755 -- GitLab