summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute/v2/test_flavor.py
Commit message (Collapse)AuthorAgeFilesLines
* move unit tests to new "unit" test moduleSteve Martinelli2016-09-081-825/+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 identity fake classes instead of old unit tests dataHuanxuan Ao2016-07-261-37/+25
| | | | | | | | | Use FakeProject, FakeDomain and FakeUser classes instead of old test data in image, compute and volume. (This work has done in network) Change-Id: Ic37d5d9db98f0f2acc6c714a9646063dcbde4ff3 Partially-Implements: blueprint use-fake-project
* Add Support for showing flavor access listHuanxuan Ao2016-07-221-1/+44
| | | | | | | | | Add a attribute "access_project_id" for flavor object to display the access project id list by using "flavor show" command. Change-Id: I7f0c152b816e0ca2e32e47f9b5c1aa7663d33b6d Closes-Bug:#1575461
* Add "--property" option to "flavor create" commandHuanxuan Ao2016-06-291-4/+16
| | | | | | | | Add "--property" option to "flavor create" command to support adding properties to a new falvor. Change-Id: I4f06b364375d5a81584fe41122d48e9568fa712a Closes-Bug: #1596798
* Merge "Make set/unset commands in compute/image/common return normally when ↵Jenkins2016-06-221-4/+11
|\ | | | | | | nothing specified"
| * Make set/unset commands in compute/image/common return normally when nothing ↵Tang Chen2016-06-211-4/+11
| | | | | | | | | | | | | | | | | | | | specified After this patch, all set/unset commands will return normally when nothing specified. Change-Id: Id94d0329faa1a674006a9aae901f834b41917317 Close-bug: #1588588
* | Merge "Support bulk deletion for "flavor/aggregate delete""Jenkins2016-06-221-15/+43
|\ \
| * | Support bulk deletion for "flavor/aggregate delete"Huanxuan Ao2016-06-211-15/+43
| |/ | | | | | | | | | | | | | | | | Support bulk deletion and error handling for "aggregate delete" and "flavor delete" commands. Change-Id: I3f6105cbeeab1c9f8cd571c63ce0e7ac3d4252b3 Partially-Implements: blueprint multi-argument-compute Partial-Bug: #1592906
* | Add "--project" option to the "flavor create" command.Huanxuan Ao2016-06-211-1/+27
|/ | | | | | | | Add ``--project`` and ``--project-domain`` options to the ``flavor create`` command. We can use these options to add the flavor access to a givin project when we create the flavor. Change-Id: Ic1907272c1d1ae526f9c9e86f32ba06c6da147c0
* Fix errors in ``set/unset flavor`` unit testsTang Chen2016-06-141-9/+20
| | | | | | | | | | | | | | | | | | | 1. We should assert flavor.set_keys() is called correctly or not called in ``set flavor`` unit tests. 2. Commit c7e6973ff50ff84af9ad55f7bdaeeea83ae40f0b from me removed test_flavor_unset_no_project which used to test if --project was specified as '', and assert CommandError was raised, which is incorrect. So I removed it. But after looking into the code, I think we should not remove it, but specify nothing after --project, and assert ParserException was raised. So in this patch, we fix it as so. ('--project', '') --> ('--project') assert CommandError --> assert ParserException Change-Id: Ifd33c72d5b7581aaabffb09e9b5e38ecc67e18c0
* Merge "Fix errors in flavor unit tests"Jenkins2016-06-141-24/+9
|\
| * Fix errors in flavor unit testsTang Chen2016-06-131-24/+9
| | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the problems below: 1. flavor.unset_keys() is not checked in flavor unit tests. So check them in the tests. 2. test_flavor_unset_no_project makes no sense. It is OK to specify ``--project ''`` without raising any exception. It can pass because in the test, we set nither project nor property. So remove this test. Change-Id: I04e537349936343b6d8c85b06bc6d0ba6bd41d6f
* | osc-lib: utilsDean Troyer2016-06-131-1/+1
| | | | | | | | | | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* | osc-lib: exceptionsDean Troyer2016-06-131-1/+2
|/ | | | | | | | Use osc-lib directly for exceptions. Leave openstackclient.common.exceptions for deprecation period. Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
* Fix wrong test in flavor unit testsTang Chen2016-06-031-5/+3
| | | | | | | | | | | | | In test_flavor_set_no_project(), we aimed to test a situation like this: User specifies "--project" option, but didn't specifies the project name or ID. But in the source code, it becomes "--project ''". The test could past because if project and property are both None, the command will raise an exception. Change-Id: I39567306debb901e8bad420fa2492f1b207efddc
* Add support for removing flavor-accessHuanxuan Ao2016-06-021-2/+86
| | | | | | | | Add "--project" and "--project-domain" options in "flavor unset" command to remove flavor access. Change-Id: Ia5c5a80d9890d5af066b75b4e202647c18c7d915 Partial-Bug: #1575461
* Add support for setting flavor-accessHuanxuan Ao2016-05-301-2/+97
| | | | | | | | This patch adds "--project" option in "flavor set" command to support for setting flavor access. Change-Id: I75b473600080d8ab1dd6ad01561c4f989ed3c3bd Partial-Bug: #1575461
* Merge "Make "flavor show" command to show a private flavor properly"Jenkins2016-05-061-13/+9
|\
| * Make "flavor show" command to show a private flavor properlyHuanxuan Ao2016-05-021-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "flavor show" command could not show a private flavor by flavor name becauce it could not find a private flavor by flavor name. In "until.find_resource(parsed_args.flavor)", If parsed_args.falvor is a name of a flavor, "flavors.find(name=parsed_args.flavor)"will be called to find a flavor.But the default value of "is_public" is "Ture" in "flavors.find()" so that we can only find public flavors.If we want to find all flaovrs by flavor name,we should add "is_public=None" in "flavors.find()". So I tried to change "until.find_resource(parsed_args.flavor)" to "until.find_resource(parsed_args.flavor, is_public=None)", but then I could not find any flavor by flavor id because "is_public" is an unexpected argument of "flavors.get()" in "until.find_resource()". In this case,I think "until.find_resource()" can not find a private flavor properly,and we should combine "manager.get(flavor.id)" and "manager.find(name=flavor.name, is_public=None)" by ourselve to find a flavor. Also,this bug affects other flavor commands like "flavor set/unset/delete",so I fix them in this patch too. Change-Id: I4a4ed7b0a2f522ee04d1c3270afcda7064285c39 Closes-Bug: #1575478
* | Add a unit test for "flavor create" commandHuanxuan Ao2016-05-041-0/+160
|/ | | | | | | There was not a unit test for "flavor create" command in the "test_flavor.py".So I add the unit test. Change-Id: Ib1e821ea524eb33c0ba73643164228c7b83253b4
* Fix error in flavor set/unset commandHuanxuan Ao2016-04-281-4/+8
| | | | | | | | | | In the "flavor set/unset" command,the "flavor" parameter can be a name but can not be a id of a flavor. I think we should find a flavor by using "utils.find_resource()" in these commands. Change-Id: I5836788f7ed18813f1ebde31bb808b7c3f932b80 Closes-Bug: #1575624
* Merge "Make SetFlavor and UnsetFlavor inherit from cliff.Command"Jenkins2016-02-291-10/+4
|\
| * Make SetFlavor and UnsetFlavor inherit from cliff.CommandTang Chen2016-02-271-10/+4
| | | | | | | | | | | | set/unset comamnd classes should inherit from cliff.Command class. Change-Id: I54e5608ac0768d7d94b7f7d516ea1948daefdc1b Partial-Bug: 1546065
* | [Compute] Check return value is None in compute unit tests.Tang Chen2016-02-271-2/+2
|/ | | | | | | | | take_action() in commands inheriting from Command returns nothing. So we should assert the return is None in the unit tests of these commands. Change-Id: I953480ecff3b5beb12255d866d0e1df45f130efd Partial-Bug: #1550636
* Add unit test for "flavor show" commandTang Chen2016-02-201-10/+77
| | | | Change-Id: I1591649e5b97a885707042fcccad3335ee8c7aec
* Trivial: Fix "abstractmethod" to "abstract method"Tang Chen2016-02-101-5/+5
| | | | | | | | | As Richard <rtheis@us.ibm.com> has pointed out, "abstractmethod" should be "abstract method". This is a small typo I have made when I fix DisplayCommandBase comment bug. Change-Id: I84f1a3158896257686a0a7efa1123eef1b85139f Partial-bug: #1477199
* Compute: Fix DisplayCommandBase comments for cliff Lister subclass testsTang Chen2016-02-061-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 compute tests. Change-Id: Idc54ad21eaa1371ebd601327b8d962c7039f2de0 Partial-bug: #1477199
* Trivial: Coding style fix in test_flavor.pyTang Chen2015-12-081-4/+4
| | | | Change-Id: I3dcb3c4fbd9ff9c351426ae2ad9da009208a6485
* Add unit testcases for "openstack flavor delete"xiexs2015-11-301-0/+46
| | | | Change-Id: If23a71c678193e5c9c91300fddd17e79f674bf82
* Use FakeFlavor in TestFlavorUnset.Tang Chen2015-11-281-7/+4
| | | | | Change-Id: Ifbd360db39d380efd9632300367b13283ac75f54 Implements: blueprint improve-flavor-unit-test
* Use FakeFlavor in TestFlavorSet.Tang Chen2015-11-281-5/+4
| | | | | Change-Id: I335298b07afb3f969c76748527dda06cb5393fa8 Implements: blueprint improve-flavor-unit-test
* Use FakeFlavor in TestFlavorList.Tang Chen2015-11-281-11/+8
| | | | | Change-Id: I3595877bed41bc476934ca924f1f9c8c0ad79176 Implements: blueprint improve-flavor-unit-test
* Refactor: Move FakeFlavorResource to compute_fakes.py.Tang Chen2015-11-281-19/+3
| | | | | | | Just like FakeServer and FakeResource, FakeFlavorResource should be in compute_fakes.py. Change-Id: I8315256fb90377605fa2190e24c9674f6aaf6efd Implements: blueprint improve-flavor-unit-test
* Refactor: Abstract datalist out in TestFlavorList to avoid redundant code.Tang Chen2015-11-281-53/+20
| | | | | | | | datalist has been set in each test case in TestFlavorList, which is not necessary. This patch abstract it out and remove all redundant code. Change-Id: I6f735f7d9fa29a8ab435adaef17ca559df1fdcee Implements: blueprint improve-flavor-unit-test
* Refactor: Abstract columns out in TestFlavorList to avoid redundant code.Tang Chen2015-11-281-53/+20
| | | | | | | | The columns has been set in each test case of TestFlavorList, which is not necessary. This patch abstract it out and remove all redundant code. Change-Id: Ideb2872f073755ac251bd603fd906410ea86c4ef Implements: blueprint improve-flavor-unit-tes
* Support pagination params for flavor listliyingjun2015-10-211-5/+15
| | | | | | | | Missing 'marker' and 'limit' params for `openstack flavor list` shell command. It would be nice to have this when there are many flavors. Closes-bug: #1505874 Change-Id: I088ac5d24f0d7595f5cbce14f063e296a449eb26
* Add the ability to set and unset flavor propertiesMarek Aufart2015-03-191-1/+76
| | | | | | | | | | Added flavor set and unset command which allow manage flavor properties called extra_specs. Command flavor show output was extended with these properties. Closes-Bug: 1434137 Change-Id: Ie469bade802de18aab9d58eda3fff46064008163
* Added capabilities/options to 'openstack flavor list'Igor_Bolotin2015-02-031-0/+274
command to match capabilities already provided by 'nova flavor-list': —public | --private | --all options allows to list public only (default), private only or all flavors. —long displays more field. This option also fetches properties (extra-specs) for each flavor using separate API call for each flavor and it’s too slow to be done by default. However as an administrator - sometimes I need to be able to see them for all flavors. Removed empty “Extra Specs” column as well as "Swap" and "RXTX Factor" from default output. DocImpact Closes-Bug: #1416780 Change-Id: I30cfa2c75e28daf17b936543a177c23ae1743c37