def test_is_hm_port_bound(self):
    self.patch_object(api_crud, 'session_from_identity_service')
    self.patch_object(api_crud, 'init_neutron_client')
    self.patch_object(api_crud, 'lookup_hm_port')
    self.lookup_hm_port.return_value = None
    self.assertEquals(api_crud.is_hm_port_bound('ids', 'fake-unit-name'), None)
    self.lookup_hm_port.assert_called_once_with(mock.ANY, 'fake-unit-name')
    self.lookup_hm_port.return_value = {'binding:vif_type': 'nonfailure'}
    self.assertTrue(api_crud.is_hm_port_bound('ids', 'fake-unit-name'))
    self.lookup_hm_port.return_value = {'binding:vif_type': 'binding_failed'}
    self.assertFalse(api_crud.is_hm_port_bound('ids', 'fake-unit-name'))
def test_is_hm_port_bound(self):
    self.patch_object(api_crud, 'session_from_identity_service')
    self.patch_object(api_crud, 'init_neutron_client')
    self.patch_object(api_crud, 'lookup_hm_port')
    self.lookup_hm_port.return_value = None
    self.assertEquals(api_crud.is_hm_port_bound('ids', 'fake-unit-name'), None)
    self.lookup_hm_port.assert_called_once_with(mock.ANY, 'fake-unit-name')
    self.lookup_hm_port.return_value = {'binding:vif_type': 'nonfailure'}
    self.assertTrue(api_crud.is_hm_port_bound('ids', 'fake-unit-name'))
    self.lookup_hm_port.return_value = {'binding:vif_type': 'binding_failed'}
    self.assertFalse(api_crud.is_hm_port_bound('ids', 'fake-unit-name'))