Debian Codegraph @

heatclient/tests/unit/test_build_info.py

raw symbols SCIP
1 # Copyright 2012 OpenStack Foundation
2 # All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 from unittest import mock
17
18 from oslo_serialization import jsonutils
19 import testtools
20
21 from heatclient.tests.unit import fakes
22 from heatclient.v1 import build_info
23
24
25 class BuildInfoManagerTest(testtools.TestCase):
26 def setUp(self):
27 super().setUp()
28 self.client = mock.Mock()
29 self.client.get.return_value = fakes.FakeHTTPResponse(
30 200,
31 None,
32 {'content-type': 'application/json'},
33 jsonutils.dumps('body')
34 )
35 self.manager = build_info.BuildInfoManager(self.client)
36
37 def test_build_info_makes_a_call_to_the_api(self):
38 self.manager.build_info()
39 self.client.get.assert_called_once_with('/build_info')
40
41 def test_build_info_returns_the_response_body(self):
42 response = self.manager.build_info()
43 self.assertEqual('body', response)