summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute/v2/fakes.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Fix mutable default arguments in tests"Jenkins2016-04-201-26/+33
|\
| * Fix mutable default arguments in testsTang Chen2016-04-201-26/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add "server group create" commandRui Chen2016-04-201-0/+34
|/ | | | | | | | | Support compute v2 "server group create" command in OSC. Implements: blueprint nova-server-group-support Partial-Bug: #1542171 Change-Id: I96ffb07764d3adb715e048943cfee3b879c280f6
* Remove methods argument from FakeHypervisorStatsTang Chen2016-04-151-2/+1
| | | | | | | methods argument is not necessary in FakeHypervisorStats class. Remove it. Change-Id: I288f71b412beb3e583e957a9fd99210bc6f3f543
* Remove fake methods code from compute networkTang Chen2016-04-121-77/+15
| | | | | | | | | | | | Network objects don't have any method needs to fake. keys() method is only used by _get_columns() helper to obtain all attributes of an object. But in compute network implementation, attributes are obtained from obj._info directly, which is a dictionary itself. So there is no need to fake this method. Change-Id: Ie6a46ef6a3042641e55a7002573ef501db7b60e1
* Trivial: Rename FakehypervisorStats to FakeHypervisorStatsTang Chen2016-04-051-2/+2
| | | | Change-Id: I138b1b8a3327947b8cd032d8d0c32d98548ce2ad
* Merge "Add "aggregate unset" to osc"Jenkins2016-03-301-0/+32
|\
| * Add "aggregate unset" to oscRui Chen2016-03-241-0/+32
| | | | | | | | | | | | | | | | Support "aggregate unset" command in order to remove the property of aggregate object in OSC. Change-Id: I49645135586362f0fd251f5e4a4c03eff273d9e9 Closes-Bug: #1559866
* | Refactor security group rule create to use SDKRichard Theis2016-03-231-3/+3
|/ | | | | | | | | | | | | Refactored the 'os security group rule create' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. Added a release note for the change in security group rules output due to Network v2. Change-Id: I8c6c99d5272ff5d410a449f73d198d834c5cd96e Partial-Bug: #1519512 Implements: blueprint neutron-client
* Merge "[compute] Add set host command"Jenkins2016-03-171-0/+56
|\
| * [compute] Add set host commandjichenjc2016-02-261-0/+56
| | | | | | | | | | | | set host command is missing, add it as SetHost class. Change-Id: I7acb94150718b7150598632cbebc3d85018a0d59
* | Support "--long" option in ListServiceRui Chen2016-03-141-0/+2
| | | | | | | | | | | | | | | | Add "--long" option in ListService so that compute service disabled reason can be showed. Change-Id: I1ace8f1c4e4efe0a1a8f6710425d73eb5db9e5e1 Closes-Bug: #1556815
* | Refactor security group show to use SDKRichard Theis2016-03-101-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the 'os security group show' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. Added a release note for the change in security group rules output due to Network v2. The column names remain unchanged to maintain backwards compatibility. Change-Id: I25233ddb8115d18b8b88affb3de13346084a339d Partial-Bug: #1519511 Implements: blueprint neutron-client
* | Remove FakeFlavorResource classTang Chen2016-03-091-29/+16
| | | | | | | | | | | | | | | | | | In unit tests, all real methods are faked. They should not do any real operations in the tests. So, FakeFlavorResource is not necessary. Just fake get_keys(), set_keys and unset_keys() in FakeResource would be enough. Change-Id: Icc3473ba9c77f4817d0edddb7ff3e1bd2946fac7
* | Trivial: Fix incorrect comments in compute fakes.pyTang Chen2016-03-081-3/+3
|/ | | | Change-Id: I18b1720af13b444527dda1ecab52e3cc8d8d9376
* Merge "[compute] Add unit test for keypair"Jenkins2016-03-041-0/+55
|\
| * [compute] Add unit test for keypairjichenjc2016-02-231-0/+55
| | | | | | | | | | | | keypair do not have unit test, this patch adds it. Change-Id: Id702ccaad239b916340bb17014d1ede0a28aaec9
* | Refactor security group list to use SDKRichard Theis2016-02-291-0/+64
|/ | | | | | | | | | | | | | | | | | | | Refactored the 'os security group list' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. This refactor also removes the logic for displaying project names instead of project IDs when the --all-projects option is specified. This logic was removed because it is inconsistent with the other network commands. Since neutron will always display security groups across all projects for an admin, the --all-projects option is now hidden when neutron is enabled and the Project column is always displayed. Change-Id: I934a1f5084ef3c5f929d0ffd38ebf5064d799941 Partial-Bug: #1519511 Related-to: blueprint neutron-client
* Merge "Floating IP: Neutron support for "ip floating show" command"Jenkins2016-02-251-0/+1
|\
| * Floating IP: Neutron support for "ip floating show" commandTang Chen2016-02-241-0/+1
| | | | | | | | | | | | Change-Id: I30350076621c83c758927444e5f8bcc2b7d0fc74 Partial-Bug: 1519502 Related-to: blueprint neutron-client
* | Merge "Fixed a bunch of spacing"Jenkins2016-02-251-0/+2
|\ \
| * | Fixed a bunch of spacingBrandon Palm2016-02-231-0/+2
| |/ | | | | | | | | | | | | Nothing too complicated here. I fixed a bunch of spacing issues that I saw in OSC. Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
* | Add some test cases for "server list" commandting.wang2016-02-241-0/+6
|/ | | | | | | | Add some test cases that test 'server list' command when specifying flavor or image. Because I add some attribution to fake.py, I have to change some code in create server test. Despite all this, I think it's good for testing. Change-Id: I714deac1f6f940b790a3c20af5f7ffa724ac44d1
* Merge "Add unit tests for 'hypervisor stats' command"Jenkins2016-02-231-0/+61
|\
| * Add unit tests for 'hypervisor stats' commandting.wang2016-02-221-0/+61
| | | | | | | | | | | | | | 'hypervisor stats show' command isn't covered by unit tests, so add unit tests to test it. Change-Id: Ic355230cbdd596e848191b599803dca7f27c2ffb
* | Initialize _keys in __init__() in FakeFlavorResourceTang Chen2016-02-231-2/+5
|/ | | | | | | | | | | _keys is defined as a class attribute in FakeFlavorResource. So when we call set_keys() to update it, it changes. And this change may bring trouble to the other tests afterward. So define and initialize it in __init__() as an object attribute. Change-Id: Ib18c03877b67e1b7c2e107f598076b928a58e4fb Closes-bug: #1548378
* Add unit test for "flavor show" commandTang Chen2016-02-201-0/+12
| | | | Change-Id: I1591649e5b97a885707042fcccad3335ee8c7aec
* Merge "Support "network show" command in nova network"Jenkins2016-02-181-2/+31
|\
| * Support "network show" command in nova networkTang Chen2016-02-171-2/+31
| | | | | | | | | | | | | | | | "network show" command is not implemented in nova network. This patch implements it. Change-Id: I1fadd890fe36c4e3ac5c9ed389b20c5b2fff8aca partial-Bug: 1543672
* | Merge "Support "network list" command in nova network"Jenkins2016-02-181-0/+58
|\ \ | |/
| * Support "network list" command in nova networkTang Chen2016-02-171-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "network list" command is not implemented in nova network. This patch implements it. The Network object in novaclient is quite different from the one in sdk. And the output of "network list" using Nova network is also quite different from using Neutron. It is like this: # openstack network list +--------------------------------------+---------+-------------+ | ID | Name | Subnet | +--------------------------------------+---------+-------------+ | 96a98ec4-31f6-45f6-99e6-9384569b3bb5 | private | 10.0.0.0/24 | +--------------------------------------+---------+-------------+ --long and --external options have not been implemented because the attrs in Network object in novaclient is too much different. This patch also introduces a new FakeNetwork class in compute/v2/fake.py to fake nova network. Change-Id: Id1fdf81fb2fa8b39f2c76b7bae37ac4fecafd0f7 Depends-On: I1b59264cd40aaf1062f4e8db233ccb7fd0e95f0e partial-Bug: 1543672
* | Merge "Refactor security group rule delete to use SDK"Jenkins2016-02-181-0/+62
|\ \ | |/ |/|
| * Refactor security group rule delete to use SDKRichard Theis2016-02-101-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the 'os security group rule delete' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. This patch set also introduces new FakeSecurityGroupRule classes for testing network and compute security group rules. And fixes were made to the network FakeSecurityGroup class. Change-Id: I8d0917925aa464e8255defae95a2a2adfb6cfb75 Partial-Bug: #1519512 Related-to: blueprint neutron-client
* | Define FakeFloatingIP class in tests/compute for nova network commandsTang Chen2016-02-161-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "ip floating list" command is not available for Neutron now because the implementation is incorrect. The FloatingIP objects returned from Nova and Neutron network are quite different. So they need different FakeFloatingIP class to do the tests. This patch copies class FakeFloatingIP in tests/network to tests/compute for Nova network tests. Will fix the problem in "ip floating list" command and change FakeFloatingIP in tests/network to fit Neutron network tests. Change-Id: Ia29d257868e0f1dc6cd7cfe3819875e5913f76ec Partial-Bug: 1519502 Partially implements: blueprint neutron-client
* | Support "network delete" command in nova networkTang Chen2016-02-141-0/+4
| | | | | | | | | | | | | | | | | | "network delete" command is not implemented in nova network. This patch implements it. Change-Id: I5dac1eed6eb8e67298bb446418835a6ab85c859c Depends-On: I1b59264cd40aaf1062f4e8db233ccb7fd0e95f0e partial-Bug: 1543672
* | Floating IP: Neutron support for "ip floating delete" commandJude Job2016-02-141-0/+3
|/ | | | | | | | | | This patch implements "ip floating delete" command for both compute and network. Also includes unit tests. Change-Id: Ie61f0faad65ec90f9d9956ae463412be8d963d05 partial-Bug: 1519502 Related-to: blueprint neutron-client Co-Authored-By: Tang Chen <chen.tang@easystack.cn>
* Merge "Add unit tests for "hypervisor show" command"Jenkins2016-02-081-0/+26
|\
| * Add unit tests for "hypervisor show" commandTang Chen2016-02-071-0/+26
| | | | | | | | Change-Id: Ib75e5eb5b197e9d58fb87a595a43b8774b7b1987
* | Define security_group_rules mock in FakeComputev2ClientTang Chen2016-02-061-0/+3
| | | | | | | | | | | | | | security_group_rules mock should be defined in FakeComputev2Client, and used in each test class. Change-Id: I44bb6379b2c1b6cb277296e08e25dd4d7255c276
* | Move security_groups mock definition to FakeComputev2ClientTang Chen2016-02-061-0/+14
|/ | | | | | All compute client related mocks should be defined in FakeComputev2Client. Change-Id: Ie75385af772ca23286c4cf131d3d54cc14f20a30
* Add unit tests for "hypervisor list" commandTang Chen2016-02-051-0/+45
| | | | | | | | | | | There is no unit tests for "hypervisor" command. This patch introudces a new class FakeHypervisor to fake one or more hypervisors, and a base class TestHypervisor. Also adds hypervisors mock to fake compute client. And also, this patch adds unit tests for "hypervisor list" command. Change-Id: I18733eae1a8f4fff72e830d9a060fb8f0f58fbf5
* Refactor "os availability zone list"Richard Theis2016-01-141-0/+62
| | | | | | | | | | | | Refactor the "os availability zone list" command to make it a common command instead of a compute-only command. Since availability zones are common to compute, volume and network (new), this refactoring allows availability zone support to be added for volume and network. In addition to the refactor, unit and functional tests were added. Change-Id: I63e9d41d229b21cd38e5a083493042c096d65e05 Partial-Bug: #1532945
* Use FakeVolume in server test cases.Tang Chen2015-12-081-2/+0
| | | | | | | | We have a class FakeVolume to fake one or more volumes. So use it in test_server.py. Change-Id: I735ae7f678a6799e0ae4c7c25c8083d9ebf47b09 Implements: blueprint improve-volume-unittest-framework
* Merge "Add project name/ID validation for "openstack quota show""Jenkins2015-12-011-0/+2
|\
| * Add project name/ID validation for "openstack quota show"xiexs2015-11-291-0/+2
| | | | | | | | | | | | | | A validation is necessary to check the existence of project. This patch is similar to Ia2d8c96527820e25b074e6486d3f39c5ad7eae60. Change-Id: Id8895ba7a21ecad05942619a82a87c0dc68eae53
* | Add testcases for compute.v2.servicexiexs2015-12-011-2/+9
|/ | | | | | | | | Add a set of testcases to test the classes of ListService and SetService in the compute.v2.service. And to be consistent with cinder term, use service_binary to represent the service binary. Change-Id: I9fe740f07c9ce3afdba7b7cca152d614170abb96
* Remove old fake flavor data.Tang Chen2015-11-281-12/+0
| | | | | | | | The new class FakeFlavor has been introduced to fake one or more flavors. So use it and remove the old fake flavor data. Change-Id: Ie3a33b36ae6e597c6a0b1d17ad13c73cf4b73bc9 Implements: blueprint improve-flavor-unit-test
* Introduce class FakeFlavor to fake one or more flavors.Tang Chen2015-11-281-0/+64
| | | | | Change-Id: I1b20e7d50e478ce8114ca08aa455b7acad4ea7f5 Implements: blueprint improve-flavor-unit-test
* Refactor: Move FakeFlavorResource to compute_fakes.py.Tang Chen2015-11-281-0/+21
| | | | | | | Just like FakeServer and FakeResource, FakeFlavorResource should be in compute_fakes.py. Change-Id: I8315256fb90377605fa2190e24c9674f6aaf6efd Implements: blueprint improve-flavor-unit-test
* Move FakeServer to tests.common.v2.compute.fakeslin-hua-cheng2015-11-251-0/+70
| | | | | | | FakeServer should not be in tests.fakes since this should be just for generic re-usable classes. Change-Id: I19209952de69626dfa3caadc5d1cc69b7feadeba