python-moganclient/moganclient/tests/unit/osc/v1/test_availability_zone.py
liusheng 4b41199343 Change the column name of listing az to "Zone Name"
Make it more human readable.

Change-Id: I5401cfcb6d7951aafecc8bcb0ed3e0baccb77a2e
2017-09-13 09:14:57 +08:00

40 lines
1.6 KiB
Python

# Copyright 2016 Huawei, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import mock
from moganclient.osc.v1 import availability_zone
from moganclient.tests.unit import base as test_base
from moganclient.v1 import availability_zone as az_mgr
@mock.patch.object(az_mgr.AvailabilityZoneManager, '_list')
class TestAvailabilityZoneList(test_base.TestBaremetalComputeV1):
def setUp(self):
super(TestAvailabilityZoneList, self).setUp()
self.cmd = availability_zone.ListAvailabilityZone(self.app, None)
self.fake_az = ("az1", "az2", "az3")
def test_list_az(self, mock_list):
arglist = []
verifylist = []
mock_list.return_value = [self.fake_az]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
mock_list.assert_called_once_with('/availability_zones',
response_key='availability_zones')
self.assertEqual(('Zone Name',), columns)
self.assertEqual(((('az1', 'az2', 'az3'),),), data)