Fix unit tests returning values (#80499)

pull/80504/head
Matt Clay 2 years ago committed by GitHub
parent bd22b849c6
commit 74b102b33c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,6 +48,9 @@ class BaseFactsTest(unittest.TestCase):
@patch('platform.system', return_value='Linux')
@patch('ansible.module_utils.facts.system.service_mgr.get_file_content', return_value='systemd')
def test_collect(self, mock_gfc, mock_ps):
self._test_collect()
def _test_collect(self):
module = self._mock_module()
fact_collector = self.collector_class()
facts_dict = fact_collector.collect(module=module, collected_facts=self.collected_facts)
@ -62,4 +65,3 @@ class BaseFactsTest(unittest.TestCase):
facts_dict = fact_collector.collect_with_namespace(module=module,
collected_facts=self.collected_facts)
self.assertIsInstance(facts_dict, dict)
return facts_dict

@ -93,7 +93,7 @@ class TestApparmorFacts(BaseFactsTest):
collector_class = ApparmorFactCollector
def test_collect(self):
facts_dict = super(TestApparmorFacts, self).test_collect()
facts_dict = super(TestApparmorFacts, self)._test_collect()
self.assertIn('status', facts_dict['apparmor'])
@ -191,7 +191,7 @@ class TestEnvFacts(BaseFactsTest):
collector_class = EnvFactCollector
def test_collect(self):
facts_dict = super(TestEnvFacts, self).test_collect()
facts_dict = super(TestEnvFacts, self)._test_collect()
self.assertIn('HOME', facts_dict['env'])
@ -355,7 +355,6 @@ class TestSelinuxFacts(BaseFactsTest):
facts_dict = fact_collector.collect(module=module)
self.assertIsInstance(facts_dict, dict)
self.assertEqual(facts_dict['selinux']['status'], 'Missing selinux Python library')
return facts_dict
class TestServiceMgrFacts(BaseFactsTest):

Loading…
Cancel
Save