def test_stop_remotecopy(self, svc_authorize_mock, svc_run_command_mock, start_mock): set_module_args({ 'clustername': 'clustername', 'domain': 'domain', 'username': '******', 'password': '******', 'name': 'test_name', 'state': 'stopped', }) with pytest.raises(AnsibleExitJson) as exc: obj = IBMSVCStartStopReplication() obj.apply() self.assertEqual(True, exc.value.args[0]['changed'])
def test_for_failure_with_activeactive(self, svc_authorize_mock, svc_run_command_mock): set_module_args({ 'clustername': 'clustername', 'domain': 'domain', 'username': '******', 'password': '******', 'name': 'test_name', 'state': 'started', 'clean': 'true' }) with pytest.raises(AnsibleFailJson) as exc: obj = IBMSVCStartStopReplication() obj.apply() self.assertEqual(True, exc.value.args[0]['failed'])
def test_stop_remotecopy_when_isgroup(self, svc_authorize_mock, svc_run_command_mock, existing_rccg_mock, start_mock): set_module_args({ 'clustername': 'clustername', 'domain': 'domain', 'username': '******', 'password': '******', 'name': 'test_name', 'state': 'stopped', 'clean': 'true', 'isgroup': 'true' }) existing_rccg_mock.return_value = { "id": "226", "name": "test_name", "master_cluster_id": "0000020321E04566", "master_cluster_name": "FlashSystem V9000", "master_vdisk_id": "226", "master_vdisk_name": "vol9", "aux_cluster_id": "0000020321E04566", "aux_cluster_name": "FlashSystem V9000", "aux_vdisk_id": "227", "aux_vdisk_name": "vol10", "primary": "master", "consistency_group_id": "", "consistency_group_name": "", "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": "" } with pytest.raises(AnsibleExitJson) as exc: obj = IBMSVCStartStopReplication() obj.apply() self.assertEqual(True, exc.value.args[0]['changed'])