def test_create_parameter_remotecluster_missing(self, svc_authorize_mock, svc_run_command_mock, existing_rc_mock): set_module_args({ 'clustername': 'clustername', 'domain': 'domain', 'state': 'present', 'username': '******', 'password': '******', 'name': 'test_name', 'master': 'test_master', 'aux': 'test_aux', 'copytype': 'metro', 'sync': 'true', 'consistgrp': 'test_consistency_group' }) svc_run_command_mock.return_value = {} with pytest.raises(AnsibleFailJson) as exc: obj = IBMSVCManageReplication() obj.create() self.assertEqual(True, exc.value.args[0]['failed'])
def test_create(self, svc_authorize_mock, svc_run_command_mock, existing_rc_mock): set_module_args({ 'clustername': 'clustername', 'domain': 'domain', 'state': 'present', 'username': '******', 'password': '******', 'name': 'test_name', 'remotecluster': 'test_remotecluster', 'master': 'test_master', 'aux': 'test_aux', 'copytype': 'global', 'sync': 'true', 'consistgrp': 'test_consistency_group' }) svc_run_command_mock.return_value = { 'message': 'RC Relationship, id [0], successfully created', 'id': '0' } existing_rc_mock.return_value = { 'id': '0', 'name': 'test_name', 'master_cluster_id': '0000020321E04566', 'master_cluster_name': 'FlashSystem V9000', 'master_vdisk_id': '0', 'master_vdisk_name': 'test_master', 'aux_cluster_id': '0000020321E04566', 'aux_cluster_name': 'FlashSystem V9000', 'aux_vdisk_id': '161', 'aux_vdisk_name': 'test_aux', 'primary': 'aux', 'consistency_group_id': '8', 'consistency_group_name': 'test_consistency_group', 'state': 'consistent_synchronized', 'bg_copy_priority': '50', 'progress': '', 'freeze_time': '', 'status': 'online', 'sync': '', 'copy_type': 'metro', 'cycling_mode': '', 'cycle_period_seconds': '300', 'master_change_vdisk_id': '', 'master_change_vdisk_name': '', 'aux_change_vdisk_id': '', 'aux_change_vdisk_name': '' } obj = IBMSVCManageReplication() create_return = obj.create() self.assertEqual('test_name', create_return['name'])