Example #1
0
 def test_successful_remove_mock(self, remove_subsystem_host_map):
     ''' removing subsystem host/map and testing idempotency '''
     data = self.set_default_args()
     data['paths'] = ['abcd/vol']
     set_module_args(data)
     my_obj = my_module()
     if not self.onbox:
         my_obj.server = MockONTAPConnection('subsystem')
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     assert exc.value.args[0]['changed']
     remove_subsystem_host_map.assert_called_with(['xyz/vol'], 'paths')
Example #2
0
 def test_ensure_get_called(self):
     ''' test get_subsystem_host_map()  for non-existent subsystem'''
     set_module_args(self.set_default_args())
     my_obj = my_module()
     my_obj.server = self.server
     assert my_obj.get_subsystem_host_map('paths') is None
Example #3
0
 def test_ensure_get_called_existing(self):
     ''' test get_subsystem_host_map()  for existing subsystem'''
     set_module_args(self.set_default_args())
     my_obj = my_module()
     my_obj.server = MockONTAPConnection(kind='subsystem')
     assert my_obj.get_subsystem_host_map('paths')
Example #4
0
 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'])