def setUp(self):
     super(TestNiosCNameRecordModule, self).setUp()
     self.module = MagicMock(
         name=
         'ansible_collections.ansible.infoblox.plugins.modules.nios_cname_record.WapiModule'
     )
     self.module.check_mode = False
     self.module.params = {'provider': None}
     self.mock_wapi = patch(
         'ansible_collections.ansible.infoblox.plugins.modules.nios_cname_record.WapiModule'
     )
     self.exec_command = self.mock_wapi.start()
     self.mock_wapi_run = patch(
         'ansible_collections.ansible.infoblox.plugins.modules.nios_cname_record.WapiModule.run'
     )
     self.mock_wapi_run.start()
     self.load_config = self.mock_wapi_run.start()
    def setUp(self):
        super(RhsmRepositoryReleaseModuleTestCase, self).setUp()

        # Mainly interested that the subscription-manager calls are right
        # based on the module args, so patch out run_command in the module.
        # returns (rc, out, err) structure
        self.mock_run_command = patch(
            'ansible_collections.ansible.unix.plugins.modules.rhsm_release.'
            'AnsibleModule.run_command')
        self.module_main_command = self.mock_run_command.start()

        # Module does a get_bin_path check before every run_command call
        self.mock_get_bin_path = patch(
            'ansible_collections.ansible.unix.plugins.modules.rhsm_release.'
            'AnsibleModule.get_bin_path')
        self.get_bin_path = self.mock_get_bin_path.start()
        self.get_bin_path.return_value = '/testbin/subscription-manager'
Exemple #3
0
 def setUp(self):
     self.mock_module = patch.multiple(basic.AnsibleModule,
                                       exit_json=exit_json,
                                       fail_json=fail_json)
     self.mock_module.start()
     self.mock_sleep = patch('time.sleep')
     self.mock_sleep.start()
     set_module_args({})
     self.addCleanup(self.mock_module.stop)
     self.addCleanup(self.mock_sleep.stop)