def test_device_show_algorithms_2(self, mock_driver, mock_db_api): """capabilities is empty""" mock_db_api.return_value = self.dict_list mock_driver.return_value = drv = mock.MagicMock() drv.get_capabilities.return_value = {} resp = api.device_show_algorithms(self.conf) self.assertEqual(resp, [])
def test_device_show_algorithms_1(self, mock_driver, mock_db_api): """capabilities is not empty, not None""" mock_db_api.return_value = self.dict_list mock_driver.return_value = drv = mock.MagicMock() drv.get_capabilities.return_value = {"algorithms": ["CRYSIS"]} resp = api.device_show_algorithms(self.conf) self.assertEqual(resp, ["CRYSIS"])
def show_algorithms(self, req): logger.debug("Got algorithms request. Request: %s", req) algorithms = core_api.device_show_algorithms(self.conf) return {'algorithms': algorithms}
def test_device_show_algorithms_0(self, mock_driver, mock_db_api): """capabilities = None""" mock_driver.get_capabilities = None mock_db_api.return_value = self.dict_list resp = api.device_show_algorithms(self.conf) self.assertEqual(resp, [])
def show_algorithms(self, req): LOG.debug("Got algorithms request. Request: %s", req) algorithms = core_api.device_show_algorithms(self.conf) return {"algorithms": algorithms}