aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/api/actions/test_env.py
blob: e674d73d23aa8a42319ded43bb5995d8ca224def (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
##############################################################################
# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import unittest
import mock

from api.actions import env


class CreateInfluxDBContainerTestCase(unittest.TestCase):

    @mock.patch('api.actions.env._create_influxdb_container')
    def test_create_influxdb_container(self, mock_create_container):
        env.createInfluxDBContainer({})
        mock_create_container.assert_called_with()


class CreateInfluxdbContainerTestCase(unittest.TestCase):

    @mock.patch('api.actions.env.Client')
    def test_create_influxdb_container(self, mock_influx_client):
        env._create_influxdb_container()
        self.assertFalse(mock_influx_client()._create_container.called)


class ConfigInfluxdbTestCase(unittest.TestCase):

    @mock.patch('api.actions.env.influx.get_data_db_client')
    def test_config_influxdb(self, mock_influx_client):
        env._config_influxdb()
        mock_influx_client.assert_called_with()


class ConfigOutputFile(unittest.TestCase):

    def test_config_output_file(self):
        pass


def main():
    unittest.main()


if __name__ == '__main__':
    main()