'detach volume and remove host in DS8K.'

@mock.patch.object(helper.DS8KCommonHelper, '_get_host_ports')
@mock.patch.object(helper.DS8KCommonHelper, '_get_mappings')
def test_terminate_connection_and_remove_host(self, mock_get_mappings, mock_get_host_ports):

    self.driver = FakeDS8KProxy(self.storage_info, self.logger, self.exception, self)
    self.driver.setup(self.ctxt)
    vol_type = volume_types.create(self.ctxt, 'VOL_TYPE', {})
    location = six.text_type({'vol_hex_id': TEST_VOLUME_ID})
    volume = self._create_volume(volume_type_id=vol_type.id, provider_location=location)
    host_ports = [{'wwpn': TEST_SOURCE_WWPN_1, 'state': 'logged    in', 'hosttype': 'LinuxRHEL', 'addrdiscovery': 'lunpolling', 'host_id': TEST_HOST_ID}, {'wwpn': TEST_SOURCE_WWPN_2, 'state': 'unconfigured', 'hosttype': 'LinuxRHEL', 'addrdiscovery': 'lunpolling', 'host_id': ''}]
    mappings = [{'lunid': TEST_LUN_ID, 'link': {}, 'volume': {'id': TEST_VOLUME_ID, 'link': {}}}]
    mock_get_host_ports.side_effect = [host_ports]
    mock_get_mappings.side_effect = [mappings]
    self.driver.terminate_connection(volume, TEST_CONNECTOR)
