summaryrefslogtreecommitdiff
path: root/openstackclient/tests/common
Commit message (Collapse)AuthorAgeFilesLines
* move unit tests to new "unit" test moduleSteve Martinelli2016-09-0811-1761/+0
| | | | | | | | this will better isolate the unit tests from the functional tests. unfortunately, the "integration" tests had to be lumped into the "unit" tests since we need the separation in testr.conf Change-Id: Ifd12198c1f90e4e3c951c73bfa1884ab300d8ded
* Use assertIn(A, B) instead of assertTrue(A in B )Bin Zhou2016-09-021-6/+6
| | | | | | | | Developers should use assertIn(A, B) instead of assertTrue(A in B ). TrivialFix Change-Id: I0d7c542272315590536c427a8865e49660361e55
* Allow setting quotas for server groups and server group membersElena Ezhova2016-07-271-0/+6
| | | | | | | | Adds support of --server-groups and --server-group-members options to the "quota set" command. Change-Id: I178d1e267d010be7e908adefcf3b15abdafd9da4 Closes-Bug: #1602223
* Merge "Use assertEqual() instead of assertDictEqual()"Jenkins2016-07-261-1/+1
|\
| * Use assertEqual() instead of assertDictEqual()Tang Chen2016-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | In unittest2, assertDictEqual() is implemented by using != operator to compare two dicts. So is assertEqual() in testtools. assertEqual() in testtools is able to handle dict, list, set and so on. So we just call assertEqual() to make the unit tests simpler. Change-Id: Ice343b2ce468acae39d2ad79f7121503e3627656
* | Merge "Standardize import format"Jenkins2016-07-263-4/+3
|\ \ | |/ |/|
| * Standardize import formatshizhihui2016-07-223-4/+3
| | | | | | | | | | | | | | | | According to the rule in http://docs.openstack.org/developer/hacking/#imports I modify some irregular import format. Change-Id: Ibf29ccaf3ddec4a956334cc3368ebee7a66e282c
* | Rework clientmanagerDean Troyer2016-07-221-340/+27
|/ | | | | | | | * Add compatibility for plugin v2 interface removed from osc-lib * ClientManager.is_network_endpoint_enabled() is wrapper for new is_service_available() Change-Id: I6f26ce9e4d0702f50c7949bacfbeeb0f98cddb5d
* Merge "osc-lib: api.auth"Jenkins2016-07-071-2/+2
|\
| * osc-lib: api.authDean Troyer2016-06-301-2/+2
| | | | | | | | | | | | Move auth plugin checking to osc-lib. Change-Id: I673d9c2d6e8bbf724c3000459a729e831d747814
* | Improve masking of secrets in configuration showAlvaro Lopez Garcia2016-06-211-3/+14
|/ | | | | | | | | | | | The command "configuration show" tries to redact some of the secrets that are shown on the screen. However, this failed redacting options that were marked as secrete by the auth plugins (if any) and it redacted other options that were not redacted at all. For example, when using the OpenID Connect plugins, it redacted the "access_token_endpoint" as the word "token" appears there, but it failed to redact "client_secret" even when this option is marked as secret in the corresponding plugin. Change-Id: Idfad4fbbe5ddcff5e729e1dcd756d0379ad31dee
* Do not prompt for scope options with default scoped tokensDolph Mathews2016-06-171-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | This changes the scope validation to occur after a token has already been created. Previous flow: 1. Validate authentication options. 2. Validate authorization options if the command requires a scope. 3. Create a token (using authentication + authorization options) 4. Run command. This means that scope was being checked, even if a default scope was applied in step 3 by Keystone. New flow: 1. Validate authentication options. 2. Create token (using authentication + authorization options) 3 Validate authorization options if the command requires a scope and the token is not scoped. 4. Run command. Change-Id: Idae368a11249f425b14b891fc68b4176e2b3e981 Closes-Bug: 1592062
* Finish osc-lib transition for command.pyDean Troyer2016-06-151-1/+1
| | | | | | | | | https://review.openstack.org/#/c/328318/ was the transition of openstackclient/common/command.py to osc-lib but it was incomplete; https://review.openstack.org/#/c/329885/ started to fix it but was also incomplete. Third time is charm? Change-Id: Ib6c0266155c2155ae59067ce7b15bebca1e375e8
* osc-lib: timingDean Troyer2016-06-131-94/+0
| | | | Change-Id: I3fe27d98efa5090e084c676f7f8e6dad0157ed21
* osc-lib: commandDean Troyer2016-06-131-1/+1
| | | | | | | Leave command.py and test_command.py as a sanity check during the deprecation period. Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
* osc-lib: parseractionsDean Troyer2016-06-131-0/+3
| | | | | | | Leave parseractions.py and test_parseractions.py as a sanity check during the deprecation period. Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
* osc-lib: logsDean Troyer2016-06-131-6/+9
| | | | Change-Id: I2a4d40cd72cc22e97a600751ae29c2309ebed28b
* osc-lib: utilsDean Troyer2016-06-131-401/+0
| | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* osc-lib: exceptionsDean Troyer2016-06-133-4/+6
| | | | | | | | Use osc-lib directly for exceptions. Leave openstackclient.common.exceptions for deprecation period. Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
* Moving authentication from keystoneclient to keystoneauthNavid Pustchi2016-06-091-9/+12
| | | | | | | | | | | | | | | | | Currently OpenStackClient uses keystoneclient for authentication. This change will update OpenStackClient to use keystoneauth for authentication. All dependant test have been updated. Updating how auth_ref is set in the tests to use KSA fixtures had some racy side-effects. The user_role_list tests failed when they picked up an auth_ref that was a fixture. This exposed a weakness in ListUserRole that needed to be fixed at the same time re handling of unscoped tokens and options. Change-Id: I4ddb2dbbb3bf2ab37494468eaf65cef9213a6e00 Closes-Bug: 1533369
* Merge "Error handling for KeyValueAction class."Jenkins2016-06-081-10/+7
|\
| * Error handling for KeyValueAction class.Huanxuan Ao2016-06-081-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | The set --property command requires that the input match the "key=value" type, but if the type don't match, the return value will be None, and the command still can be implemented successfully, this may confuse the users. I think we should raise exception if the argument type don't match "key=value". So I make some changes in KeyValueAction class in this patch. Change-Id: I14e64922faa7e083bc8b5e7e1cac41ef8117c224 Closes-Bug: #1589935
* | Update unit test test_extension with fake classHuanxuan Ao2016-06-071-81/+75
|/ | | | | | | Add FakeExtension class in networkv2, computev2, volumev2, identityv2_0 and update unit test test/common/test_extension.py Change-Id: I94815de7801860edb7fa91a7d146455cab946652
* Fix --enable options on commandsRichard Theis2016-06-021-0/+15
| | | | | | | | | | | | The --enable option on commands is ignored when the arguments are parsed. This is related to the --enable-beta-commands option. Renaming the option to --os-beta-command fixes the problem. There's no need to handle backwards compatibility for the option name change because there hasn't been an OSC release yet with beta commands. Change-Id: I0327ba8a2058858a83e9a42e231470ed733cc834 Closes-Bug: #1588384
* Add network support for "quota set"Fang Zhen2016-05-191-0/+59
| | | | | | | | | | The "quota set" command support compute and volume quotas previously. This patch add support network. Partially-implements: blueprint neutron-client-quota Closes-bug: 1489441 Change-Id: I9d297f52bc30614b3493f09ed15f8f1d3f8ff952
* Support quota show for current projectRichard Theis2016-04-211-0/+11
| | | | | | | | | | The "os quota show" command "<project/class>" argument is now optional. If not specified, the user's current project is used. This allows non-admin users to show quotas for their current project. Change-Id: I602d4cc09c9d29ce84271eff78137f8810cb1a47 Closes-Bug: #1572733
* Propagate AttributeErrors when lazily loading pluginsTim Burke2016-04-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if an AttributeError was raised in a plugin's make_client method, the plugin simply wouldn't be an attribute of the ClientManager, producing tracebacks like Traceback (most recent call last): File ".../openstackclient/shell.py", line 118, in run ret_val = super(OpenStackShell, self).run(argv) ... File ".../openstackclient/object/v1/container.py", line 150, in take_action data = self.app.client_manager.object_store.container_list( File ".../openstackclient/common/clientmanager.py", line 66, in __getattr__ raise AttributeError(name) AttributeError: object_store This made writing minimal third-party auth plugins difficult, as it obliterated the original AttributeError. Now, AttributeErrors that are raised during plugin initialization will be re-raised as PluginAttributeErrors, and the original traceback will be preserved. This gives much more useful information to plugin developers, as in Traceback (most recent call last): File ".../openstackclient/shell.py", line 118, in run ret_val = super(OpenStackShell, self).run(argv) ... File ".../openstackclient/object/v1/container.py", line 150, in take_action data = self.app.client_manager.object_store.container_list( File ".../openstackclient/common/clientmanager.py", line 57, in __get__ err_val, err_tb) File ".../openstackclient/common/clientmanager.py", line 51, in __get__ self._handle = self.factory(instance) File ".../openstackclient/object/client.py", line 35, in make_client interface=instance._interface, File ".../openstackclient/common/clientmanager.py", line 258, in get_endpoint_for_service_type endpoint = self.auth_ref.service_catalog.url_for( PluginAttributeError: 'NoneType' object has no attribute 'url_for' Change-Id: I0eee7eba6eccc6d471a699a381185c4e76da10bd
* Merge "Support client certificate/key"Jenkins2016-04-061-0/+17
|\
| * Support client certificate/keyCedric Brandily2016-04-061-0/+17
| | | | | | | | | | | | | | | | | | | | This change enables to specify a client certificate/key with: * usual CLI options (--os-cert/--os-key) * usual environment variables ($OS_CERT/$OS_KEY) * os-client-config Change-Id: Ibeaaa5897ae37b37c1e91f3e47076e4e8e4a8ded Closes-Bug: #1565112
* | Don't mask authorization errorsHidekazu Nakamura2016-04-011-0/+12
|/ | | | | | | | | Project show with name argument returns 'Could not find resource' error when the user is not authorized. It should report the authorization error instead. This patch makes that change. Change-Id: Iac3521f8a411060b0ec9ef46c8f0e1f3551e56ae Closes-Bug: #1511625
* Use assertItemsEqual() instead of assertListEqual()Tang Chen2016-03-141-10/+2
| | | | | | | | assertListEqual() is order sensitive. So we need to sort the lists before we compare them. Use assertItemsEqual() instead is better. Change-Id: I9eaa98716c7401f5b099b007438acc916dae619b
* Merge "Fixed command list"Jenkins2016-03-111-6/+10
|\
| * Fixed command listBrandon Palm2016-03-091-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cliff module expects an array of tuples however the array that this function was returning was an array of tuples that was also containing an array of values for the commands attached to each group and the cliff module wasn't liking it. The output now comes out looking like: | openstack.common | limits show | | | extension list | | openstack.baremetal.v1 | baremetal set | Change-Id: Ifa1c149cb5c66ba27dc72bf72d7c8f2f50e42f73 Closes-Bug: 1545609
* | Enhance list extension unit testFang Zhen2016-03-111-40/+117
|/ | | | | | | | Extension list involves identity, compute, volume and network. Current test covers only identity and network. This patch added test against compute and volum. Also refactored current implentation. Change-Id: If9b36cba24c50a817a17f685801e418fb898596a
* Add MultiKeyValueAction to custom parser actionTang Chen2016-02-271-0/+129
| | | | | | | | | | | | | | Class MultiKeyValueAction will be used to parse arguments like this: --route destination=xxx,gateway=xxx --route destination=yyy,gateway=yyy The result is a list like this: [{destination:xxx, gateway:xxx}, {destination:yyy, gateway:yyy}] This action also contain validation of the parameters. Change-Id: Ie3aa8635c6a13fc2e429fe6922acd681dc7244cf
* Fixed a bunch of spacingBrandon Palm2016-02-236-1/+9
| | | | | | | Nothing too complicated here. I fixed a bunch of spacing issues that I saw in OSC. Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
* Support unscoped token requestguang-yee2016-02-191-0/+25
| | | | | | | | Make scope check optional for the "token issue" command as unscoped token is a valid Keystone V2/V3 API. Change-Id: Ie1cded4dbfdafd3a78c0ebdf89e3f66762509930 Closes-Bug: #1543214
* Don't use Mock.called_once_with that does not existTang Chen2016-02-191-1/+1
| | | | | | | | | | | Class mock.Mock does not exist method "called_once_with()", it just exists method "assert_called_once_with()". "called_once_with()" does nothing because it's a mock object. In OSC, only one place is still using "called_once_with()". Fix it. Change-Id: Ib890e95d775c3fc43df80fa05c82d726e78cdac8 Partial Bug: 1544522
* Fix DisplayCommandBase comments for cliff Lister subclass testsTang Chen2016-02-094-13/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As bug #1477199 describes, the wrong comment below is all over the unit test code of OSC. # DisplayCommandBase.take_action() returns two tuples There is no such class named DisplayCommandBase in OSC. It is in cliff. All OSC command classes inherit from the base classes in cliff, class Command, class Lister and class ShowOne. It is like this: Object |--> Command |--> DisplayCommandBase |--> Lister |--> ShowOne take_action() is an abstract method of class Command, and generally is overwritten by subclasses. * Command.take_action() returns nothing. * Lister.take_action() returns a tuple which contains a tuple of columns and a generator used to generate the data. * ShowOne.take_action() returns an iterator which contains a tuple of columns and a tuple of data. So, this problem should be fixed in 3 steps: 1. Remove all DisplayCommandBase comments for tests of classes inheriting from class Command in cliff as it returns nothing. 2. Fix all DisplayCommandBase comments for tests of classes inheriting from class Lister in cliff. Lister.take_action() returns a tuple and a generator. 3. Fix all DisplayCommandBase comments for tests of classes inheriting from class ShowOne in cliff. ShowOne.take_action() returns two tuples. This patch finishes step 2 in all but identity tests. There are too many such comments in identity tests. So fix them all in another patch. Change-Id: I00f38d12f55abe20fa708f6349073da658622f8d Partial-bug: #1477199
* Merge "Use assert_not_called() in common tests"Jenkins2016-02-041-7/+7
|\
| * Use assert_not_called() in common testsDean Troyer2016-02-031-7/+7
| | | | | | | | | | | | | | | | | | In https://review.openstack.org/#/c/273653/ Bryan Jones made a point about using mock_sleep.assert_not_called() rather than self.assertFalse(mock_sleep.called), so let's make that change throughout these tests. Change-Id: I826d608836955383891b303355edcca7b62faa16
* | Merge "Support listing network availability zones"Jenkins2016-02-041-0/+65
|\ \
| * | Support listing network availability zonesRichard Theis2016-02-021-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the "os availability zone list" command to support listing network availability zones along with the currently listed compute and volume availability zones. This adds the --network option to the command in order to only list network availability zones. By default, all availability zones are listed. The --long option was also updated to include a "Zone Resource" column which is applicable to network availability zones. Example zone resources include "network" and "router". If the Network API does not support listing availability zones then a warning message will be issued when the --network option is specified. This support requires an updated release of the SDK in order to pull in [1]. [1] https://bugs.launchpad.net/python-openstacksdk/+bug/1532274 Change-Id: I78811d659b793d9d2111ea54665d5fe7e4887264 Closes-Bug: #1534202
* | | Merge "Allow wait_for_delete to work for all clients"Jenkins2016-02-041-0/+22
|\ \ \ | | |/ | |/|
| * | Allow wait_for_delete to work for all clientsMark Vanderwiel2016-01-281-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the exception and error status strings to be passed in such that other plugins can make use of this function. There is a comment in find_resource: The exception to catch here is dependent on which client library the manager passed in belongs to. Eventually this should be pulled from a common set of client exceptions. Since I think that is a long ways off, this change will work now and also work when a common exception is defined and used. Change-Id: Iab56cd1166028caed4f1e657e0b1ee81af3f48d8
* | | Add "os port show" commandRichard Theis2016-02-021-0/+9
| |/ |/| | | | | | | | | | | | | Add "os port show" command. Change-Id: Id87c81640e74c60ae8f247c722c64fdadff022a2 Partial-Bug: #1519909 Partially-Implements: blueprint neutron-client
* | Fix showing network quotas for a projectRichard Theis2016-02-021-7/+18
|/ | | | | | | | | | | | | | | | | The OpenStack SDK is now used for the network client. However, the 'openstack quota show' command wasn't updated for the client change. As a result, the command will fail to show network quotas when a project name is specified. For example: $ openstack quota show admin 'Proxy' object has no attribute 'show_quota' This patch set fixes the command by using the OpenStack SDK to get network quotas for a project. Change-Id: I59a7b6780a7b80cd09e79d40d214751b25d3016e Related-To: blueprint neutron-client Closes-Bug: #1528249
* Merge "Support listing volume availability zones"Jenkins2016-01-221-10/+89
|\
| * Support listing volume availability zonesRichard Theis2016-01-141-10/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the "os availability zone list" command to support listing volume availability zones along with the currently listed compute availability zones. This adds a --compute and --volume option to the command in order to select the availability zones to list. By default, all availability zones are listed. If the Block Storage API does not support listing availability zones then an warning message will be issued. Change-Id: I8159509a41bd1fb1b4e77fdbb512cf64a5ac11a9 Closes-Bug: #1532945
* | Merge "Refactor "os availability zone list""Jenkins2016-01-221-0/+113
|\ \ | |/