Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously ext-list does not inherits ListCommand base class for listing and cannot specify columns to display. This commit changes ext-list to use ListCommand and adds a unit test for extensions. This also changes the default value of _formatters in ListCommand to {}. By this subclasses no longer override _formatters unless required. Fixes bug 1161866 Change-Id: Ifd9ab54d4e84a2b7a1d7eecd67f6270ec643db1d
- Loading branch information
Showing
13 changed files
with
77 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
|
||
# Copyright 2013 NEC Corporation | ||
# 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 sys | ||
|
||
from quantumclient.quantum.v2_0.extension import ListExt | ||
from quantumclient.quantum.v2_0.extension import ShowExt | ||
from tests.unit.test_cli20 import CLITestV20Base | ||
from tests.unit.test_cli20 import MyApp | ||
|
||
|
||
class CLITestV20Extension(CLITestV20Base): | ||
id_field = 'alias' | ||
|
||
def test_list_extensions(self): | ||
resources = 'extensions' | ||
cmd = ListExt(MyApp(sys.stdout), None) | ||
contents = [{'alias': 'ext1', 'name': 'name1', 'other': 'other1'}, | ||
{'alias': 'ext2', 'name': 'name2', 'other': 'other2'}] | ||
ret = self._test_list_resources(resources, cmd, | ||
response_contents=contents) | ||
ret_words = set(ret.split()) | ||
# Check only the default columns are shown. | ||
self.assertTrue('name' in ret_words) | ||
self.assertTrue('alias' in ret_words) | ||
self.assertFalse('other' in ret_words) | ||
|
||
def test_show_extension(self): | ||
# -F option does not work for ext-show at the moment, so -F option | ||
# is not passed in the commandline args as other tests do. | ||
resource = 'extension' | ||
cmd = ShowExt(MyApp(sys.stdout), None) | ||
args = [self.test_id] | ||
ext_alias = self.test_id | ||
self._test_show_resource(resource, cmd, ext_alias, args, fields=[]) |