コード例 #1
0
 def test_create_existing_relationship(self, svc_authorize_mock,
                                       svc_run_command_mock,
                                       existing_rc_mock, create_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'state': 'present',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'remotecluster': 'test_remotecluster',
         'master': 'test_master_1',
         'aux': 'test_aux_1',
         'copytype': 'global',
         'sync': 'true',
         'consistgrp': 'test_consistency_group_1',
     })
     existing_rc_mock.return_value = {
         'id': '157',
         'name': 'test_name',
         'master_cluster_id': '0000020321E04566',
         'master_cluster_name': 'FlashSystem V9000',
         'master_vdisk_id': '157',
         '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': ''
     }
     with pytest.raises(AnsibleExitJson) as exc:
         obj = IBMSVCManageReplication()
         obj.apply()
     self.assertEqual(True, exc.value.args[0]['changed'])
コード例 #2
0
 def test_delete_non_existing_relationship(self, svc_authorize_mock,
                                           svc_run_command_mock,
                                           existing_rc_mock):
     set_module_args({
         'clustername': 'clustername',
         'domain': 'domain',
         'state': 'absent',
         'username': '******',
         'password': '******',
         'name': 'test_name',
         'remotecluster': 'test_remotecluster',
         'master': 'test_master',
         'aux': 'test_aux',
         'copytype': 'metro',
         'sync': 'true',
         'consistgrp': 'test_consistency_group',
     })
     existing_rc_mock.return_value = {}
     with pytest.raises(AnsibleExitJson) as exc:
         obj = IBMSVCManageReplication()
         obj.apply()
     self.assertEqual(False, exc.value.args[0]['changed'])