'verify the exception thrown when there are no networks defined.'

def test_allocate_for_instance_no_networks(self):

    self.instance = fake_instance.fake_instance_obj(self.context, **self.instance)
    api = neutronapi.API()
    self.moxed_client.list_networks(tenant_id=self.instance.project_id, shared=False).AndReturn({'networks': model.NetworkInfo([])})
    neutronapi.get_client(mox.IgnoreArg()).AndReturn(self.moxed_client)
    self.moxed_client.list_networks(shared=True).AndReturn({'networks': model.NetworkInfo([])})
    self.mox.ReplayAll()
    nwinfo = api.allocate_for_instance(self.context, self.instance, False, None)
    self.assertEqual(0, len(nwinfo))
