'Disable replication but pprc relationship is in invalid state.'

@mock.patch.object(helper.DS8KCommonHelper, 'get_pprc_pairs')
def test_disable_replication_if_pprc_in_invalid_state(self, mock_get_pprc_pairs):

    self.configuration.replication_device = [TEST_REPLICATION_DEVICE]
    self.driver = FakeDS8KProxy(self.storage_info, self.logger, self.exception, self)
    self.driver.setup(self.ctxt)
    group_type = group_types.create(self.ctxt, 'group', {'consistent_group_snapshot_enabled': '<is>    True'})
    group = self._create_group(host=TEST_GROUP_HOST, group_type_id=group_type.id, replication_status='enabled')
    vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {'replication_enabled': '<is>    True'})
    location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
    data = json.dumps({TEST_TARGET_DS8K_IP: {'vol_hex_id': TEST_VOLUME_ID}})
    metadata = [{'key': 'data_type', 'value': 'FB    512'}]
    volume = self._create_volume(volume_type_id=vol_type.id, provider_location=location, replication_driver_data=data, volume_metadata=metadata, group_id=group.id, replication_status='enabled')
    pprc_pairs = copy.deepcopy(FAKE_GET_PPRCS_RESPONSE['data']['pprcs'])
    pprc_pairs[0]['state'] = 'invalid'
    mock_get_pprc_pairs.side_effect = [pprc_pairs]
    self.assertRaises(exception.VolumeDriverException, self.driver.disable_replication, self.ctxt, group, [volume])
