def test_lb_add_probe_1(self, *mocks):
     """lb_probe['type']=None"""
     lb_probe = {'type': None}
     resp = api.lb_add_probe(self.conf, self.lb_id, lb_probe)
     self.assertEqual(resp, None)
     for mock in mocks:
         self.assertFalse(mock.called)
 def test_lb_add_probe_0(self, mock_unpack, mock_command, mock_driver,
                         mock_create, mock_pack, mock_sf, mock_lb):
     """lb_probe['type']!=None"""
     lb_probe = {'type': 'Gvido'}
     mock_sf.return_value.__getitem__.return_value = {'id': 'foo'}
     mock_unpack.return_value = self.dictionary
     resp = api.lb_add_probe(self.conf, self.lb_id, lb_probe)
     self.assertEqual(resp, self.dictionary)
     mock_unpack.assert_called_once_with(mock_create.return_value)
     mock_pack.assert_called_once_with(lb_probe)
     mock_create.assert_called_once_with(self.conf, mock_pack.return_value)
     mock_sf.assert_called_once_with(self.conf, mock_lb.return_value['id'])
     mock_lb.assert_called_once_with(self.conf, self.lb_id)
     with mock_driver.return_value.request_context() as ctx:
         mock_command.assert_called_once_with(ctx, {'id': 'foo'},
                                              mock_create.return_value)
예제 #3
0
 def create(self, req, tenant_id, lb_id, body):
     LOG.debug("Got addProbe request. Request: %s", req)
     probe = core_api.lb_add_probe(self.conf, tenant_id, lb_id,
                                   body['healthMonitoring'])
     LOG.debug("Return probe: %r", probe)
     return {'healthMonitoring': probe}
예제 #4
0
 def test_lb_add_probe_0(self, *mocks):
     """lb_probe['type']!=None"""
     lb_probe = {'type': 'Gvido'}
     api.lb_add_probe(self.conf, self.lb_id, lb_probe)
     for mok in mocks:
         self.assertTrue(mok.called)
예제 #5
0
 def addProbe(self, req, **args):
     logger.debug("Got addProbe request. Request: %s", req)
     probe_id = core_api.lb_add_probe(self.conf, args['id'],
                            args['body']['healthMonitoring'])
     return "probe: %s" % probe_id
 def test_lb_add_probe_2(self, *mocks):
     """lb_probe['type']!=None"""
     lb_probe = {'type': 'Gvido'}
     mocks[5].side_effect = IndexError
     with self.assertRaises(exc.ServerFarmNotFound):
         api.lb_add_probe(self.conf, self.lb_id, lb_probe)
 def test_lb_add_probe_2(self, mock_sf, mock_lb):
     """Exception"""
     lb_probe = {'type': 'Gvido'}
     mock_sf.return_value = []
     with self.assertRaises(exc.ServerFarmNotFound):
         api.lb_add_probe(self.conf, self.lb_id, lb_probe)
예제 #8
0
 def addProbe(self, req, id, body):
     logger.debug("Got addProbe request. Request: %s", req)
     probe = core_api.lb_add_probe(self.conf, id,
                                   body['healthMonitoring'])
     logger.debug("Return probe: %r", probe)
     return {'healthMonitoring': probe}