def test_ensure_image_get_called(self):
     ''' a more interesting test '''
     set_module_args(self.set_default_args())
     my_obj = my_module()
     my_obj.server = self.server
     cluster_image_get = my_obj.cluster_image_get()
     print('Info: test_software_update_get: %s' % repr(cluster_image_get))
     assert cluster_image_get is None
 def test_ensure_apply_for_update_called_idempotent(self):
     ''' updating software and checking idempotency '''
     module_args = {}
     module_args.update(self.set_default_args())
     set_module_args(module_args)
     my_obj = my_module()
     my_obj.autosupport_log = Mock(return_value=None)
     if not self.use_vsim:
         my_obj.server = self.server
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print('Info: test_software_update_apply: %s' % repr(exc.value))
     assert not exc.value.args[0]['changed']
 def test_ensure_apply_for_update_called(self):
     ''' updating software and checking idempotency '''
     module_args = {}
     module_args.update(self.set_default_args())
     module_args.update({'package_version': 'PlinyTheElder'})
     set_module_args(module_args)
     my_obj = my_module()
     my_obj.autosupport_log = Mock(return_value=None)
     if not self.use_vsim:
         my_obj.server = MockONTAPConnection('software_update', 'async_pkg_get_phase_complete', 'abc')
     with pytest.raises(AnsibleExitJson) as exc:
         # replace time.sleep with a noop
         with patch('time.sleep', lambda a: None):
             my_obj.apply()
     print('Info: test_software_update_apply: %s' % repr(exc.value))
     assert exc.value.args[0]['changed']
 def test_module_fail_when_required_args_missing(self):
     ''' required arguments are reported as errors '''
     with pytest.raises(AnsibleFailJson) as exc:
         set_module_args({})
         my_module()
     print('Info: %s' % exc.value.args[0]['msg'])