def test_lb_show_sticky0(self, db_api0, db_api1, db_api2):
     db_api0.return_value = {'sticky': 'foo'}
     db_api1.return_value = self.dict_list
     db_api2.return_value.__getitem__.return_value.\
                          __getitem__.return_value = 2
     resp = api.lb_show_sticky(self.conf, self.lb_id)
     self.assertEqual(resp, {"sessionPersistence": [{'sticky': 'foo'},
                                                    {'sticky': 'foo'}]})
     self.assertTrue(db_api0.called)
     self.assertTrue(db_api0.call_count == 2)
     self.assertTrue(db_api1.called)
     self.assertTrue(db_api2.called)
     db_api0.assert_any_call(self.dict_list[0])
     db_api0.assert_any_call(self.dict_list[1])
     db_api1.assert_called_once_with(self.conf, 2)
     db_api2.assert_called_once_with(self.conf, self.lb_id)
示例#2
0
 def test_lb_show_sticky1(self, db_api0, db_api1, db_api2):
     db_api1.return_value = self.dict_list
     db_api2.return_value = []
     with self.assertRaises(exc.ServerFarmNotFound):
         api.lb_show_sticky(self.conf, self.lb_id)
示例#3
0
 def test_lb_show_sticky0(self, db_api0, db_api1, db_api2):
     db_api1.return_value = self.dict_list
     api.lb_show_sticky(self.conf, self.lb_id)
     self.assertTrue(db_api0.called)
 def showStickiness(self, req, **args):
     logger.debug("Got showStickiness request. Request: %s", req)
     result = core_api.lb_show_sticky(self.conf, args['id'])
     return result
 def test_lb_show_sticky1(self, db_api0, db_api1, db_api2):
     db_api2.return_value = []
     with self.assertRaises(exc.ServerFarmNotFound):
         api.lb_show_sticky(self.conf, self.lb_id)
         self.assertFalse(db_api0.called)
         self.assertFalse(db_api1.called)
示例#6
0
 def index(self, req, tenant_id, lb_id):
     LOG.debug("Got showStickiness request. Request: %s", req)
     result = core_api.lb_show_sticky(self.conf, tenant_id, lb_id)
     return result