def test_ensure_get_called_valid_snapshot(self, mock_base, client_f):
     set_module_args(self.set_default_args())
     mock_base.return_value = Mock()
     client_f.return_value = Mock()
     my_obj = snapshot_module()
     my_obj.netapp_client.snapshots = self.netapp_client.snapshots
     assert my_obj.get_azure_netapp_snapshot() is not None
 def test_ensure_delete_called(self, mock_delete, mock_get, client_f, mock_base):
     data = self.set_default_args()
     data['state'] = 'absent'
     set_module_args(data)
     mock_base.return_value = Mock()
     client_f.return_value = Mock()
     mock_get.return_value = Mock()
     my_obj = snapshot_module()
     my_obj.netapp_client.snapshots = self.netapp_client.snapshots
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.exec_module()
     assert exc.value.args[0]['changed']
     mock_delete.assert_called_with()
 def test_module_fail_when_required_args_missing(self):
     ''' required arguments are reported as errors '''
     with pytest.raises(AnsibleFailJson) as exc:
         set_module_args({})
         snapshot_module()
     print('Info: %s' % exc.value.args[0]['msg'])