@@ -0,0 +1,2236 @@
+# Copyright 2015 NEC Corporation.  All rights reserved.%0A#%0A#    Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A#    not use this file except in compliance with the License. You may obtain%0A#    a copy of the License at%0A#%0A#         http://www.apache.org/licenses/LICENSE-2.0%0A#%0A#    Unless required by applicable law or agreed to in writing, software%0A#    distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A#    License for the specific language governing permissions and limitations%0A#    under the License.%0A%0Aimport httplib2%0A%0Afrom oslo_serialization import jsonutils as json%0Afrom oslotest import mockpatch%0A%0Afrom tempest.services.compute.json import availability_zone_client%0Afrom tempest.tests import base%0Afrom tempest.tests import fake_auth_provider%0A%0A%0Aclass TestAvailabilityZoneClient(base.TestCase):%0A%0A    FAKE_AVAILABIRITY_ZONE_INFO = %5B%0A        %7B%0A            %22zoneState%22: %7B%0A                %22available%22: True%0A            %7D,%0A            %22hosts%22: None,%0A            %22zoneName%22: u'%5Cxf4'%0A        %7D%0A    %5D%0A%0A    def setUp(self):%0A        super(TestAvailabilityZoneClient, self).setUp()%0A        fake_auth = fake_auth_provider.FakeAuthProvider()%0A        self.client = availability_zone_client.AvailabilityZoneClient(%0A            fake_auth, 'compute', 'regionOne')%0A%0A    def _test_list_availability_zones(self, bytes_body=False):%0A        serialized_body = json.dumps(%7B%0A            %22availabilityZoneInfo%22: self.FAKE_AVAILABIRITY_ZONE_INFO%7D)%0A        if bytes_body:%0A            serialized_body = serialized_body.encode('utf-8')%0A%0A        mocked_resp = (httplib2.Response(%7B'status': 200%7D), serialized_body)%0A        self.useFixture(mockpatch.Patch(%0A            'tempest.common.service_client.ServiceClient.get',%0A            return_value=mocked_resp))%0A        resp = self.client.list_availability_zones()%0A        self.assertEqual(%7B%0A            %22availabilityZoneInfo%22: self.FAKE_AVAILABIRITY_ZONE_INFO%7D, resp)%0A%0A    def test_list_availability_zones_with_str_body(self):%0A        self._test_list_availability_zones()%0A%0A    def test_list_availability_zones_with_bytes_body(self):%0A        self._test_list_availability_zones(bytes_body=True)%0A

Add unit test for availability_zone_client