Debian Codegraph @

heatclient/tests/unit/osc/v1/test_build_info.py

raw symbols SCIP
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12 #
13
14 from unittest import mock
15
16 from heatclient.osc.v1 import build_info as osc_build_info
17 from heatclient.osc.v1 import common
18 from heatclient.tests.unit.osc.v1 import fakes as orchestration_fakes
19
20
21 class TestBuildInfo(orchestration_fakes.TestOrchestrationv1):
22 response = {"api": {
23 "revision": "{api_build_revision}"
24 },
25 "engine": {
26 "revision": "{engine_build_revision}"
27 }
28 }
29
30 def setUp(self):
31 super().setUp()
32 self.cmd = osc_build_info.BuildInfo(self.app, None)
33 self.mock_client = self.app.client_manager.orchestration
34 self.mock_client.build_info.build_info = mock.Mock(
35 return_value=self.response)
36
37 def test_build_info(self):
38 arglist = []
39 parsed_args = self.check_parser(self.cmd, arglist, [])
40 columns, data = self.cmd.take_action(parsed_args)
41 self.mock_client.build_info.build_info.assert_called_with()
42 self.assertEqual(['api', 'engine'], columns)
43 self.assertEqual([
44 common.JsonColumn({"revision": "{api_build_revision}"}),
45 common.JsonColumn({"revision": "{engine_build_revision}"})
46 ], list(data))