def test_create_fcmap_but_fcmap_existed(self, svc_authorize_mock, flashcopymap_probe_mock, get_fc_mapping_mock): set_module_args({ 'clustername': 'clustername', 'domain': 'domain', 'state': 'present', 'username': '******', 'password': '******', 'name': 'vol_clone_fcmapping', 'mdiskgrp': 'Ansible-Pool', 'volume': 'source-vol', 'clone': 'clone-vol' }) fcmap_ret = [{ 'id': '0', 'name': 'vol_clone_fcmapping', 'source_vdisk_id': '0', 'source_vdisk_name': 'volume_Ansible_collections', 'target_vdisk_id': '1', 'target_vdisk_name': 'volume_Ansible_clone', 'group_id': '', 'group_name': '', 'status': 'idle_or_copied', 'progress': '0', 'copy_rate': '0', 'start_time': '', 'dependent_mappings': '0', 'autodelete': 'off', 'clean_progress': '100', 'clean_rate': '50', 'incremental': 'off', 'difference': '100', 'grain_size': '256', 'IO_group_id': '0', 'IO_group_name': 'io_grp0', 'partner_FC_id': '', 'partner_FC_name': '', 'restoring': 'no', 'rc_controlled': 'no', 'keep_target': 'no', 'type': 'generic', 'restore_progress': '0', 'fc_controlled': 'no', 'owner_id': '', 'owner_name': '' }] get_fc_mapping_mock.return_value = fcmap_ret flashcopymap_probe_mock.return_value = [] volume_created = IBMSVCClone() with pytest.raises(AnsibleExitJson) as exc: volume_created.apply() self.assertFalse(exc.value.args[0]['changed']) get_fc_mapping_mock.assert_called_with()
def test_fcmap_create_get_fc_mapping_called(self, svc_authorize_mock, mock_flashcopymap_probe, get_fc_mapping_mock): set_module_args({ 'clustername': 'clustername', 'domain': 'domain', 'state': 'present', 'username': '******', 'password': '******', 'name': 'test_get_existing_clone', 'mdiskgrp': 'Ansible-Pool', 'volume': 'source-vol', 'clone': 'clone-vol' }) fcmap_created = IBMSVCClone() mock_flashcopymap_probe.return_value = [] with pytest.raises(AnsibleExitJson) as exc: fcmap_created.apply() self.assertFalse(exc.value.args[0]['changed']) get_fc_mapping_mock.assert_called_with()