def test_loadbalancer_get_all_by_project(self): values = get_fake_lb('1', 'tenant1') lb_ref1 = db_api.loadbalancer_create(self.conf, values) values = get_fake_lb('2', 'tenant2') lb_ref2 = db_api.loadbalancer_create(self.conf, values) lbs1 = db_api.loadbalancer_get_all_by_project(self.conf, 'tenant1') lbs2 = db_api.loadbalancer_get_all_by_project(self.conf, 'tenant2') self.assertEqual(len(lbs1), 1) self.assertEqual(len(lbs2), 1) self.assertNotEqual(lbs1[0]['id'], lbs2[0]['id'])
def test_loadbalancer_get_all_by_project(self): values = get_fake_lb("1", "tenant1") lb_ref1 = db_api.loadbalancer_create(self.conf, values) values = get_fake_lb("2", "tenant2") lb_ref2 = db_api.loadbalancer_create(self.conf, values) lbs1 = db_api.loadbalancer_get_all_by_project(self.conf, "tenant1") lbs2 = db_api.loadbalancer_get_all_by_project(self.conf, "tenant2") self.assertEqual([dict(lb_ref1.iteritems())], [dict(lb.iteritems()) for lb in lbs1]) self.assertEqual([dict(lb_ref2.iteritems())], [dict(lb.iteritems()) for lb in lbs2]) self.assertNotEqual(lbs1[0]["id"], lbs2[0]["id"])
def test_loadbalancer_get_all_by_project(self): values = get_fake_lb('1', 'tenant1') lb_ref1 = db_api.loadbalancer_create(self.conf, values) values = get_fake_lb('2', 'tenant2') lb_ref2 = db_api.loadbalancer_create(self.conf, values) lbs1 = db_api.loadbalancer_get_all_by_project(self.conf, 'tenant1') lbs2 = db_api.loadbalancer_get_all_by_project(self.conf, 'tenant2') self.assertEqual([dict(lb_ref1.iteritems())], [dict(lb.iteritems()) for lb in lbs1]) self.assertEqual([dict(lb_ref2.iteritems())], [dict(lb.iteritems()) for lb in lbs2]) self.assertNotEqual(lbs1[0]['id'], lbs2[0]['id'])
def lb_get_index(conf, tenant_id=''): lbs = db_api.loadbalancer_get_all_by_project(conf, tenant_id) lbs = [db_api.unpack_extra(lb) for lb in lbs] for lb in lbs: if 'virtualIps' in lb: lb.pop('virtualIps') return lbs
def lb_get_index(conf, tenant_id=''): lbs = db_api.loadbalancer_get_all_by_project(conf, tenant_id) lbs = [db_api.unpack_extra(lb) for lb in lbs] return lbs