summaryrefslogtreecommitdiff
path: root/openstackclient/tests/fakes.py
Commit message (Collapse)AuthorAgeFilesLines
* Standardize import formatshizhihui2016-07-221-1/+1
| | | | | | | | According to the rule in http://docs.openstack.org/developer/hacking/#imports I modify some irregular import format. Change-Id: Ibf29ccaf3ddec4a956334cc3368ebee7a66e282c
* Moving authentication from keystoneclient to keystoneauthNavid Pustchi2016-06-091-0/+15
| | | | | | | | | | | | | | | | | 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
* Fix --enable options on commandsRichard Theis2016-06-021-1/+1
| | | | | | | | | | | | 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
* Merge "Add network segment command object"Jenkins2016-05-301-0/+5
|\
| * Add network segment command objectRichard Theis2016-05-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add network segment command object in support of routed networks. This patch set includes documentation, unit tests and functional tests (currently skipped until segments enabled in neutron by default) for the following new commands: - "os network segment list" - "os network segment show" These new commands are currently marked as beta commands. Change-Id: I1a79b48dc6820fe2a39fcceb11c8cae3bda413a0 Partially-Implements: blueprint routed-networks
* | [compute] Add server backup functionjichenjc2016-05-271-0/+3
|/ | | | | | | | | | | | | | | Add server backup function There is no return value for this command per following doc http://developer.openstack.org/api-ref-compute-v2.1.html#createBackup, also novaclient can't be updated now due to backward compatible issue http://lists.openstack.org/pipermail/openstack-dev/2016-March/089376.html, so we have to get the information ourselves. The Image tests were not using warlock images, so that needed to be fixed before we could completely test things like --wait. Change-Id: I30159518c4d3fdec89f15963bda641a0b03962d1
* Refactor TestVolumeShow with FakeVolumeting.wang2016-05-171-0/+4
| | | | | | | | | | In the meantime, add some static methods in FakeVolume for ease of use and add info() method with "property" decorator in FakeResource to allow those static methods to get fake information. Change-Id: I98ad520f32afd529fda77a4592f645130282537f Co-Authored-By: xiexs <xiexs@cn.fujitsu.com> Implements: blueprint improve-volume-unittest-framework
* Fix mutable default arguments in testsTang Chen2016-04-201-2/+8
| | | | | | | | | | | | | | | | | | | Python’s default arguments are evaluated only once when the function is defined, not each time the function is called. This means that if you use a mutable default argument (like list and dict) and mutate it, you will and have mutated that object for all future calls to the function as well. More details about this wrong usage here: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments In unit tests, most FakeXXX classes' methods take mutable arguments with default values [] or {}. We should change them to None. Change-Id: Iea833b66aa1379829511ad5c6d4432b72f3488e2 Closed-bug: #1550320
* Move keys() methods in each resource class to FakeResourceTang Chen2016-04-111-0/+3
| | | | | | | | | | | | | | FakeXXX classes in network don't need to fake any method, except keys(). But keys() can be put in FakeResource since it just returns all attributes in _info. This patch moves removes all unnecessary fake methods code, moves keys() method to FakeResource. This patch also finds out some missing attributes in network and router tests. Change-Id: I799822c8715b9ac4f95b98f8350f196757d79d3e
* Fixed a bunch of spacingBrandon Palm2016-02-231-0/+9
| | | | | | | Nothing too complicated here. I fixed a bunch of spacing issues that I saw in OSC. Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
* Refactor network endpoint enablement checkingRichard Theis2016-01-041-1/+13
| | | | | | | | | | | | | | Move the network endpoint enablement checking from the 'server create' command to the common client manager. This allows future network commands to use either nova or neutron networking based on the cloud environment. This patch set also includes related unit test enhancements to the common client manager to trigger authentication on the tests. Change-Id: Ia37e81d4fb05a1e2fceb3e5d367bda769ab8e64b Related-Bug: #1519511 Related-to: blueprint neutron-client
* Move FakeServer to tests.common.v2.compute.fakeslin-hua-cheng2015-11-251-70/+0
| | | | | | | FakeServer should not be in tests.fakes since this should be just for generic re-usable classes. Change-Id: I19209952de69626dfa3caadc5d1cc69b7feadeba
* Introduce random server faking mechanism.Tang Chen2015-11-191-0/+70
| | | | | | | | | | | This patch introduces a new server faking mechanism to support multiple servers faking. Server names and ids can be generated randomly, and use APIs in class FakeServer to get one or more servers. Change-Id: Ic54f3bf7c77294dc7dfb9acdbf4a721eb5eef6af Implements: blueprint osc-unit-test-framework-improvement
* Enable FakeResource to fake methods.Tang Chen2015-11-191-1/+26
| | | | | | | | | | | | | | | | Use MagicMock to fake a method in FakeResource. A new function: add_method(name, return_value) is added to FakeResource. The caller specifies method @name and @return_value, the function will add an attribute with @name, which is a callable MagicMock object whose return value is @return_value. When user access the attribute with a (), @return_value will be returned by MagicMock, which looks like a function call. Change-Id: I12eb876cbebab064773df7b5dd612de69bbf3f01 Implements: blueprint osc-unit-test-framework-improvement
* Fix issue when displaying image_memberlin-hua-cheng2015-10-231-0/+8
| | | | | | | | image_member doesn't have a _info attribute, glanceclient returns warlock object instead of a Resource object. Change-Id: If6e7c4bd404454bd6cbe8c111879c1afa1380211 Closes-Bug: #1509054
* Move session and fixtures to keystoneauth1Steve Martinelli2015-10-141-1/+1
| | | | | | | | in an effort to start consuming keystoneauth1, we can move our sesssion and fixture code over to use keystoneauth1 instead of keystoneclient. Change-Id: Ibcbd588ce2e3d864f87ff1eb6e1c3c071a1e06f6
* Add configuration show commandTerryHowe2015-07-231-0/+12
| | | | | | | | | | | | Create a `configuration show` command that displays the current configuration of the CLI. Different configurations can be displayed using options such as --os-cloud. Passwords and tokens are redacted by default unless the --unmask option is specified. Closes-Bug: #1476729 Change-Id: I0792365d0c5fa526cd09c0ed88c6bb1e2cb813a7
* Rename endpoint type to interfaceTerryHowe2015-07-151-1/+1
| | | | | Change-Id: I4e21d09bc747e8210f4f79a1d6c4c7ccf2f25d1c Closes-Bug: #1454392
* Add --os-endpoint-type cli optional argumentRoxana Gherle2015-07-021-0/+2
| | | | | | | | | | | | User should be able to specify the endpoint type through a CLI optional argument/ENV variable setting. We will name this new optional argument: --os-endpoint-type (Env: OS_ENDPOINT_TYPE) and based on the value given, the service API will use that specific endpoint type. Possible values: public, admin, internal. DocImpact Closes-Bug: #1454392 Change-Id: Ife3d4e46b44c0ddcd712b1130e27e362545a9a29
* Check volume status before extending sizelin-hua-cheng2015-02-061-1/+22
| | | | | | | Added test for Volume Set as well. Change-Id: I8e6794f67b160ca328fcafa8f1d67138b4f3becd Closes-Bug: #1415182
* Add helpful messages when authN'ing with passwordSteve Martinelli2015-01-161-0/+1
| | | | | | | | | | Setting up auth options can be complicated, and we currently don't do any checking before we build all our auth parameters to send off to keystoneclient. We should do some basic checking to guide new users. Change-Id: I9c88f1c9637b3870c151952ecc797aaf65be271a Closes-Bug: #1400531
* Upgrade hacking to 0.10Steve Martinelli2015-01-121-1/+1
| | | | | | Also resolve the only error that was produced. Change-Id: Ic81ab01aa0cddc15bb27419d7fec3e5a6d4ec0c7
* Merge "Use fixtures from keystoneclient for static data"Jenkins2014-11-121-134/+11
|\
| * Use fixtures from keystoneclient for static dataJamie Lennox2014-10-311-134/+11
| | | | | | | | | | | | | | We should use the fixture generation code from keystoneclient rather than keep our own copies of the token and discovery structure. Change-Id: I53c1d2935d1d65c39b8abea89427af2fc3edd181
* | Add --or-show option to user createDean Troyer2014-11-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --or-show option is added to create commands for the common case of needing to ensure an object exists and getting its properties if it does or creating a new one if it does not exist. Note that if the object exists, any additional options that would set values in a newly created object are ignored if the object exists. FakeResource needs the __name__ attribute to fall through utils.find_resource. Prove the concept on v2 user create then propogate once we're happy with it... Change-Id: I6268566514840c284e6a1d44b409a81d6699ef99
* | Unscoped federated user-specific commandsMatthieu Huin2014-10-301-0/+1
|/ | | | | | | | | | | | A federated user can authenticate with the v3unscopedsaml plugin and list the domains and projects she is allowed to scope to. This patch introduces the new commands 'federation domain list' and 'federation project list'. Note that for these commands -and plugin- to be available, the lxml library must be installed. Change-Id: I2707b624befcfb0a01b40a094e12fd68a3ee7773 Co-Authored-By: Florent Flament <florent.flament-ext@cloudwatt.com>
* Support for keystone auth pluginsMatthieu Huin2014-10-091-0/+136
| | | | | | | | | | | | | | | | | | | | | | | This patch allows the user to choose which authentication plugin to use with the CLI. The arguments needed by the auth plugins are automatically added to the argument parser. Some examples with the currently available authentication plugins:: OS_USERNAME=admin OS_PROJECT_NAME=admin OS_AUTH_URL=http://keystone:5000/v2.0 \ OS_PASSWORD=admin openstack user list OS_USERNAME=admin OS_PROJECT_DOMAIN_NAME=default OS_USER_DOMAIN_NAME=default \ OS_PROJECT_NAME=admin OS_AUTH_URL=http://keystone:5000/v3 OS_PASSWORD=admin \ OS_IDENTITY_API_VERSION=3 OS_AUTH_PLUGIN=v3password openstack project list OS_TOKEN=1234 OS_URL=http://service_url:35357/v2.0 \ OS_IDENTITY_API_VERSION=2.0 openstack user list The --os-auth-plugin option can be omitted; if so the CLI will attempt to guess which plugin to use from the other options. Change-Id: I330c20ddb8d96b3a4287c68b57c36c4a0f869669 Co-Authored-By: Florent Flament <florent.flament-ext@cloudwatt.com>
* Test top-to-bottom: object-store containersDean Troyer2014-09-291-1/+7
| | | | | | | | | | Replicate the object-store container command tests but use requests_mock to test the entire stack down to the requests module. These will be useful regressions tests when the existing object-store lib modules are moved to the low-level API object. Change-Id: Ibf25be46156eb1009f1b66f02f2073d3913b846d
* Change app.restapi to app.client_manager.sessionDean Troyer2014-08-251-1/+16
| | | | | | | | | | | This is step 1 toward using Keystone client's session.Session as the primary session/requests interface in OSC. * Move the session create into ClientManager and rename 'restapi' attribute to 'session' * Set up ClientManager and session loggers * Fix container and object command references to restapi/api Change-Id: I013d81520b336c7a6422cd22c05d1d65655e64f8
* Network CRUDTerry Howe2014-06-241-0/+1
| | | | | | | bp/neutron https://wiki.openstack.org/wiki/OpenStackClient/Commands#Network_2 Change-Id: I89ee083154afa544b03587e84becace36d9d522a
* Use six.iteritems() rather than dict.iteritems()Cyril Roelandt2014-02-111-1/+2
| | | | | | This is compatible with both Python 2 and 3. Change-Id: I6fe3e9bf9ece699badbdb9933118af90642a91e9
* Merge "Add module list command"Jenkins2013-12-051-0/+6
|\
| * Add module list commandDean Troyer2013-12-031-0/+6
| | | | | | | | | | | | | | | | Lists versions of installed python modules (Origianlly proposed as 'version list') Change-Id: I76a51d3d6783f46ef2daa0a41626019a880a2a50
* | Expand support for command extensionsDean Troyer2013-11-211-0/+1
|/ | | | | | | | | | | | Allows client libraries to have complete access to the rest of the OSC ClientManager. In addition, extension libraries can define global options (for API version options/env vars) and define versioned API entry points similar to the in-repo commands. The changes to ClientManager exposed some issues in the existing object api tests that needed to be cleaned up. Change-Id: Ic9662edf34c5dd130a2f1a69d2454adefc1f8a95
* Complete basic test infrastructureDean Troyer2013-11-181-0/+4
| | | | | | | This finally gets all of the API tests into a common framework regarding test classes and so forth. Change-Id: If675347129c50dcba0bfc5b6c58f5a2ca57ff46c
* Prepare for Identity v3 testsDean Troyer2013-09-091-1/+5
| | | | | | | | | * Split identity/fakes.py for v2_0 and v3 * Split identity/test_identity.py for v2_0 and v3 * Fix issues in commands with enable/disable * Clean up v2 commands Change-Id: I6e536b6a130fc556dbd7dcf9f2e76d939ca1bc1c
* Refactor fake data for projects and usersDean Troyer2013-09-041-5/+1
| | | | | | | * Move fake data structures into tests/identity/fakes.py * Use fake clients correctly and support multiple client versions Change-Id: Icacbb2ca740b63937bd2c4442af61b620638b53e
* Object API commands using our REST API layerDean Troyer2013-08-281-0/+5
| | | | | | | | | | | | | * Add object-store API to ClientManager * Add object-store client * Add Object API library in openstackclient.object.v1.lib * Add Object API {container,object} list commands * Add library tests * Add command tests This should complete the Object v1 container and object list commands Change-Id: Ib1770d45efa8871959826b85faafa1e0bcef0a03
* Add Identity v2 project testsDean Troyer2013-08-161-0/+62
* establish the the form of cliff command classes * implement some common fake objects * implement Identity command tests for v2 project * fix stdout/stderr capture Also re-work the project create and set commands for exclusive options (--enable|--disable) to actually behave properly. Yay tests! Change-Id: Icbb313db544c1f8dd3c9af7709971838b5a4d115