'Terminate connection should call unmap vol'

def test_terminate_connection_should_call_unmap_vol(self):

    driver = mock.MagicMock()
    driver.VERSION = 'VERSION'
    p = self.proxy(self.default_storage_info, mock.MagicMock(), test_mock.cinder.exception, driver)
    p._get_connection_type = mock.MagicMock(return_value=storage.XIV_CONNECTION_TYPE_FC)
    p._get_fc_targets = mock.MagicMock(return_value=TEST_WWPNS)
    p.ibm_storage_cli = mock.MagicMock()
    vol_mapping_ret = p.ibm_storage_cli.cmd.vol_mapping_list.return_value
    vol_mapping_ret.as_dict.return_value.has_keys.return_value = True
    p.ibm_storage_cli.cmd.vol_list.return_value.as_list = ['aa']
    hostname = storage.get_host_or_create_from_iqn(TEST_CONNECTOR)
    host = {'name': hostname, 'initiator': TEST_CONNECTOR['initiator'], 'id': 1}
    TEST_CONNECTOR['wwpns'] = [TEST_INITIATOR]
    setattr(p, '_get_host', mock.MagicMock(return_value=host))
    meta = p.terminate_connection(TEST_VOLUME, TEST_CONNECTOR)
    self.assertEqual(TEST_TARGET_MAP, meta['data']['initiator_target_map'])
    p.ibm_storage_cli.cmd.unmap_vol.assert_called_once_with(vol=TEST_VOLUME['name'], host=hostname)
