1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 from api.utils import influx
15 class GetDataDbClientTestCase(unittest.TestCase):
17 @mock.patch('api.utils.influx.ConfigParser')
18 def test_get_data_db_client_dispatcher_not_influxdb(self, mock_parser):
19 mock_parser.ConfigParser().get.return_value = 'file'
21 influx.get_data_db_client()
22 except Exception as e:
23 self.assertIsInstance(e, RuntimeError)
26 class GetIpTestCase(unittest.TestCase):
28 def test_get_url(self):
29 url = 'http://localhost:8086/hello'
30 output = influx._get_ip(url)
33 self.assertEqual(result, output)
36 class QueryTestCase(unittest.TestCase):
38 @mock.patch('api.utils.influx.ConfigParser')
39 def test_query_dispatcher_not_influxdb(self, mock_parser):
40 mock_parser.ConfigParser().get.return_value = 'file'
42 sql = 'select * form tasklist'
44 except Exception as e:
45 self.assertIsInstance(e, RuntimeError)
52 if __name__ == '__main__':