Reedip Banerjee | 6cca2d0 | 2015-08-28 09:24:47 +0530 | [diff] [blame] | 1 | # Copyright 2015 NEC Corporation. All rights reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | from tempest.services.compute.json import fixed_ips_client |
| 16 | from tempest.tests import fake_auth_provider |
| 17 | from tempest.tests.services.compute import base |
| 18 | |
| 19 | |
| 20 | class TestFixedIPsClient(base.BaseComputeServiceTest): |
| 21 | FIXED_IP_INFO = {"fixed_ip": {"address": "10.0.0.1", |
| 22 | "cidr": "10.11.12.0/24", |
| 23 | "host": "localhost", |
| 24 | "hostname": "OpenStack"}} |
| 25 | |
| 26 | def setUp(self): |
| 27 | super(TestFixedIPsClient, self).setUp() |
| 28 | fake_auth = fake_auth_provider.FakeAuthProvider() |
| 29 | self.fixedIPsClient = (fixed_ips_client. |
| 30 | FixedIPsClient |
| 31 | (fake_auth, 'compute', |
| 32 | 'regionOne')) |
| 33 | |
| 34 | def _test_show_fixed_ip(self, bytes_body=False): |
| 35 | self.check_service_client_function( |
| 36 | self.fixedIPsClient.show_fixed_ip, |
| 37 | 'tempest.common.service_client.ServiceClient.get', |
| 38 | self.FIXED_IP_INFO, bytes_body, |
| 39 | status=200, fixed_ip='Identifier') |
| 40 | |
| 41 | def test_show_fixed_ip_with_str_body(self): |
| 42 | self._test_show_fixed_ip() |
| 43 | |
| 44 | def test_show_fixed_ip_with_bytes_body(self): |
| 45 | self._test_show_fixed_ip(True) |