def _mock_module(self):
     mock_module = Mock()
     mock_module.params = {'gather_subset': self.gather_subset,
                           'gather_timeout': 5,
                           'filter': '*'}
     mock_module.get_bin_path = Mock(return_value=None)
     return mock_module
    def test_lsblk_uuid_no_lsblk(self):
        module = Mock()
        module.get_bin_path = Mock(return_value=None)
        lh = hardware.linux.LinuxHardware(module=module, load_on_init=False)
        lsblk_uuids = lh._lsblk_uuid()

        self.assertIsInstance(lsblk_uuids, dict)
        self.assertEqual(len(lsblk_uuids), 0)
    def test_find_bind_mounts_no_findmnts(self):
        module = Mock()
        module.get_bin_path = Mock(return_value=None)
        lh = hardware.linux.LinuxHardware(module=module, load_on_init=False)
        bind_mounts = lh._find_bind_mounts()

        self.assertIsInstance(bind_mounts, set)
        self.assertEqual(len(bind_mounts), 0)
def mock_module():
    mock_module = Mock()
    mock_module.params = {
        'gather_subset': ['all'],
        'gather_timeout': 5,
        'filter': '*'
    }
    mock_module.get_bin_path = Mock(return_value=None)
    return mock_module
 def _mock_module(self):
     mock_module = Mock()
     mock_module.params = {
         'gather_subset': self.gather_subset,
         'gather_timeout': 10,
         'filter': '*'
     }
     mock_module.get_bin_path = Mock(return_value='/usr/sbin/capsh')
     mock_module.run_command = Mock(return_value=(0, 'Current: =ep', ''))
     return mock_module
Пример #6
0
 def _mock_module(self):
     mock_module = Mock()
     mock_module.params = {
         'gather_subset': self.gather_subset,
         'gather_timeout': 10,
         'filter': '*'
     }
     mock_module.get_bin_path = Mock(return_value='/not/actually/facter')
     mock_module.run_command = Mock(return_value=(0, facter_json_output,
                                                  ''))
     return mock_module
Пример #7
0
 def _mock_module(self):
     mock_module = Mock()
     mock_module.params = {
         'gather_subset': self.gather_subset,
         'gather_timeout': 10,
         'filter': '*'
     }
     mock_module.get_bin_path = Mock(return_value='/usr/bin/lsb_release')
     mock_module.run_command = Mock(
         return_value=(0, lsb_release_a_fedora_output, ''))
     return mock_module
def mock_module(gather_subset=None, filter=None):
    if gather_subset is None:
        gather_subset = ['all', '!facter', '!ohai']
    if filter is None:
        filter = '*'
    mock_module = Mock()
    mock_module.params = {
        'gather_subset': gather_subset,
        'gather_timeout': 5,
        'filter': filter
    }
    mock_module.get_bin_path = Mock(return_value=None)
    return mock_module