summaryrefslogtreecommitdiff
path: root/openstackclient/tests/image
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Use identity fake classes instead of old unit tests data"Jenkins2016-07-261-68/+46
|\
| * Use identity fake classes instead of old unit tests dataHuanxuan Ao2016-07-261-68/+46
| | | | | | | | | | | | | | | | | | 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
* | Standardize import formatshizhihui2016-07-221-2/+1
|/ | | | | | | | According to the rule in http://docs.openstack.org/developer/hacking/#imports I modify some irregular import format. Change-Id: Ibf29ccaf3ddec4a956334cc3368ebee7a66e282c
* Merge "Add create_one_image_member() in FakeImage class and update test"Jenkins2016-07-182-13/+32
|\
| * Add create_one_image_member() in FakeImage class and update testHuanxuan Ao2016-07-152-13/+32
| | | | | | | | | | | | | | | | | | Usually we use a fake object in unit test. To match the other test, add create_one_image_member() in FakeImage class in imagev2 to create a fake image member, delete the old data and update the unit test of image. Change-Id: I062a362b15db7e8bc89ec48c540d310199fd6c0b
* | image list: Add Checksum columnMarc Abramowitz2016-07-112-0/+4
|/ | | | | | | | | The checksum could potentially be useful for spotting duplicated images or checking if images with the same name are identical or different. Closes-Bug: #1602073 Change-Id: Ia0c41970c846d550de14297e18bc738e847e5a3b
* fix a few spelling mistakesgecong19732016-07-041-1/+1
| | | | | | | - overwriten should be overwritten - retrun should be return Change-Id: I1567402f4d5c7253e6a54d8753e3f201af7e6a54
* Make set/unset commands in compute/image/common return normally when nothing ↵Tang Chen2016-06-211-2/+2
| | | | | | | | | | specified After this patch, all set/unset commands will return normally when nothing specified. Change-Id: Id94d0329faa1a674006a9aae901f834b41917317 Close-bug: #1588588
* Merge "Make set/unset command in identity and image pass normally when ↵Jenkins2016-06-171-0/+26
|\ | | | | | | nothing specified"
| * Make set/unset command in identity and image pass normally when nothing ↵sunyajing2016-06-171-0/+26
| | | | | | | | | | | | | | | | | | specified Also update its unit tests. Change-Id: I82b90658b0d4247cdc9a650f14aceda640a32059 Partial-bug: #1588588
* | Merge "Fix image delete multiple arguments error"Jenkins2016-06-141-0/+31
|\ \ | |/ |/|
| * Fix image delete multiple arguments errorsunyajing2016-06-131-0/+31
| | | | | | | | | | | | | | | | | | Fix image delete command, support processing multiple arguments delete error. Fix doc/source/command-errors.rst, make the msg format correct. Change-Id: Icbe347fe077bc148bf71ea8f7399b0e934b7cdf9 Partially-Implements: blueprint multi-argument-image
* | osc-lib: utilsDean Troyer2016-06-133-7/+6
| | | | | | | | | | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* | osc-lib: exceptionsDean Troyer2016-06-132-2/+4
|/ | | | | | | | Use osc-lib directly for exceptions. Leave openstackclient.common.exceptions for deprecation period. Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
* Add "image unset" commandsunyajing2016-05-282-0/+95
| | | | | | | | This patch add a command that supports unsetting image tags and properties Change-Id: I6f2cf45a61ff89da6664f3a34ae49fdd85d8c986 Closes-Bug:#1582968
* Fix image tests to use warlock resourcesDean Troyer2016-05-202-43/+21
| | | | | | | | | | We have been testing (incorrectly) Image v2 using our usual FakeResource objects, when the v2 API actually uses warlock schema modelled resources. Bring this to the tests (TestImageSet was already doing this) Change-Id: Ia6ed3a8e28a8961f770c241b49d47cce9ff328d3
* Refactor TestRemoveProjectImage with FakeImage classting wang2016-05-161-11/+9
| | | | | | Change-Id: Id40ea8a3cf59738fa254da0bca4ad6551565f5de Co-Authored-By: xiexs <xiexs@cn.fujitsu.com> Implements: blueprint improve-image-unittest-framework
* Refactor TestImageList with FakeImage classting.wang2016-05-141-18/+21
| | | | | | Change-Id: Ia60f75f65bba4c25a0a87b570b081424f982efca Co-Authored-By: xiexs <xiexs@cn.fujitsu.com> Implements: blueprint improve-image-unittest-framework
* Refactor TestAddProjectToImage with FakeImage classxiexs2016-05-141-14/+18
| | | | | | Change-Id: I6733601f12389eb744dbf0be64b7c556356b4730 Co-Authored-By: ting wang <bx_wang@outlook.com> Implements: blueprint improve-image-unittest-framework
* Fix mutable default arguments in testsTang Chen2016-04-201-2/+4
| | | | | | | | | | | | | | | | | | | 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
* [Image] Check return value is None in image unit tests.Tang Chen2016-03-022-34/+46
| | | | | | | | | 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: I237ea772f74fa52af2e9aacd35d4b9cfb225c94c Partial-Bug: #1550636
* Fixed a bunch of spacingBrandon Palm2016-02-233-1/+5
| | | | | | | Nothing too complicated here. I fixed a bunch of spacing issues that I saw in OSC. Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
* Fix DisplayCommandBase comments for cliff ShowOne subclass testsTang Chen2016-02-102-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 3 in all but identity tests. There are too many such comments in identity tests. So fix them all in another patch. Change-Id: I1afe4852069d25d562a9448ec2bf2cff58955052 Partial-bug: #1477199
* Fix DisplayCommandBase comments for cliff Lister subclass testsTang Chen2016-02-092-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
* Fix DisplayCommandBase comments for cliff Command subclass testsTang Chen2016-02-092-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 1 in all but identity tests. There are too many such comments in identity tests. So fix them all in another patch. Change-Id: I9849baa8141ea8af2042a69afd540b77ce6ae6bd Partial-bug: #1477199
* Add --marker option to "image list" commandTang Chen2016-02-031-0/+21
| | | | | | | | Users could specify the last image (name or ID) of the previous page with --marker option to control the start image of the output. Change-Id: Idca0235ee83b1226b00c89cf3d38500fa898b7d0 Closes-Bug: #1540988
* Add limit option to "image list" commandxiexs2016-02-031-0/+17
| | | | | | | | This option is quite useful if there are too many images. Change-Id: If6a901c27c5da2d1f4412e8fa9ba3bed3b72fdd9 Co-Authored-By: Tang Chen <chen.tang@easystack.cn> Partial-Bug: #1540988
* Remove marker and loop from "image list" commandTang Chen2016-02-031-15/+4
| | | | | | | | | | | | Since --page-size has never worked, there is no paginate logic needs to be implemented in "image list" command. So remove the unnecessary loop. And also, the marker is not necessary because --marker option has not been implemented. Will add it back when implementing --marker option. Change-Id: I71fea1502f92f447a49697edb52e8e82f336772f Partial-Bug: #1540988
* Trivial: Fix wrong comment in test_image.pyTang Chen2016-02-021-1/+3
| | | | | | Code in test_image.py has nothing to do with server. Change-Id: Ia73d7b99effb394c5db9635fee6da350b0b1086b
* Refactor abstract columns and datalist out in image and objectSaiKiran2016-01-232-115/+63
| | | | | | | | | | | test cases columns and datalist has been set in each test case in image and object which is not necessary. This patch abstract it out and remove all redundant code. Change-Id: Ie6aa3fa27ab2a468c67da31209107517259631c2 Related-Bug: 1532384
* Change --owner to --project in image commandsDean Troyer2016-01-152-8/+64
| | | | | | | | | | * image create and image set now use --project to specify an alternate project to own the image * --owner is still silently accepted but deprecated, add warning messages * --project and --owner are mutually exclusive to prevent precedence issues Closes Bug: 1527833 Change-Id: Iccb1a1d9175ef9b5edcd79d294607db12641c1f0
* Add owner validation for "openstack image create/set"xiexs2015-12-211-4/+86
| | | | | | | | Owner validation is necessary if a new image owner will be created/set. Change-Id: I621774e02866bfa98a31b613deff5d7b6a962737 Closes-Bug: #1517134
* Merge "Refactor TestImageCreate with FakeImage class"Jenkins2015-12-192-53/+64
|\
| * Refactor TestImageCreate with FakeImage classxiexs2015-12-162-53/+64
| | | | | | | | | | Change-Id: I0044df36bb4d761c7998dfc8aa9a86d21d81da83 Implements: blueprint improve-image-unittest-framework
* | Merge "Add image re/deactivate commands"Jenkins2015-12-181-0/+58
|\ \ | |/ |/|
| * Add image re/deactivate commandsNiallBunting2015-12-161-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows admins to deactivate and reactivate their images. Currently this has to be done with the REST api or the glanceclient. This change introduces `--deactivate` and `--activate` for the `image set` command. This requires glanceclient 1.2.0. Which got bumped here: https://review.openstack.org/#/c/257512/ Change-Id: I476c44a0343cdc92d58ddc93fb06470242de2345 Depends-On: I2c370c6bf6ff664d94d756cc76aaa983fbdb8869 Closes-Bug: 1516661
* | Add multi deletion testcase for "openstack image delete"xiexs2015-12-091-0/+16
| | | | | | | | | | Change-Id: I5442128a290a9ad3b9ff9919431a1ecc0c697dad Implements: blueprint improve-image-unittest-framework
* | Refactor TestImageDelete with FakeImagexiexs2015-12-091-9/+13
|/ | | | | Change-Id: I052a0220ca5d974824fc46ad403234e65e8173aa Implements: blueprint improve-image-unittest-framework
* Introduce FakeImage classxiexs2015-12-021-0/+133
| | | | | | | | | | Introduce FakeImage to improve the current image unittest framework with following two advantages: 1. generate more than one faking images 2. all faking images generated by random Change-Id: Ide326fa2a047ddeea478bef97000083617a0b744 Implements: blueprint improve-image-unittest-framework
* Add status column for "openstack image list"xiexs2015-11-292-17/+28
| | | | | | | | | Actually, the status column is useful for the user. So, it`s better to output this info by default (or, user had to specify the extra option, i.e. --long). Change-Id: Id2a9f86f0de5310f8f5ff9a46bf1b7411094b519 Closes-Bug: #1519181
* Merge "Add --owner to `image create`"Jenkins2015-11-121-2/+4
|\
| * Add --owner to `image create`NiallBunting2015-11-061-2/+4
| | | | | | | | | | | | | | This adds --owner to `image create`. This is backwards compatable with v1. Change-Id: I9e79cf880c91a1386419db729818d23dfe632179 Depends-On: I8d572a070bbb04dccdd051b8e0ad199c5754746e
* | Fix issue when displaying image_memberlin-hua-cheng2015-10-231-3/+1
|/ | | | | | | | image_member doesn't have a _info attribute, glanceclient returns warlock object instead of a Resource object. Change-Id: If6e7c4bd404454bd6cbe8c111879c1afa1380211 Closes-Bug: #1509054
* image set should not show the resourceSteve Martinelli2015-10-062-14/+3
| | | | | | | | the rest of OSC set commands do not show the resource after it has been updated. unless the update fails then we report back a failure, otherwise the user should assume everything went fine. Change-Id: I2bd4188450c3853b4a1bc25f80fc9450cda32bdd
* Add tags to `image set`NiallBunting2015-10-062-4/+94
| | | | | | | | | | | | This adds --tag to the v2 version of `image set`. This is another step to compatability between the osc image api. Added merge of tags into existing tags and handling duplicates, and tests for same. Co-Authored-By: Steve Martinelli <stevemar@ca.ibm.com> Change-Id: Ie800fcbf8bbc0978c54ace3278750a18023e8ce4
* Clean up Image v2 image set commandDean Troyer2015-10-061-33/+174
| | | | | | | | | | | | | | | | Make the Image v2 image set command meet at the intersection of the v1 image set command and the v2 image create command: * Add visibility to the deadopts list and remove the option * Put the options in the same order as v1 image set * Make the help text match * Add --properties * Move the additional options that do not appear in either v1 image set or v2 image create after --property as they are really pre-defined properties * Add tests for v2 image set to match v1 and then some * Put the SetImage class in v2/image.py in alphabetical order Change-Id: I102b914e8ad09a014f6fdd846c5766b6c2eaadb8
* Merge "Glance `image set` Resolve Fracturing"Jenkins2015-09-231-2/+1
|\
| * Glance `image set` Resolve FracturingNiallBunting2015-09-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `image set` uses the new api, where other parts of osc the old api is used. This deprecates the v2 api in favour of the v1 to maintain the same commands across osc. However the functionality now remains there as people could now be using this functionality. This also adds the --unprotected argument, as in the previous version if --protected was not supplied it would just make the argument --unprotected without the users explicit consent. The patch also fixes the documentation for image set as it was outdated. Change-Id: I990d20332c80165102badef7ac94ddbeb7824950 Closes-Bug: 1498092
* | Add image create support for image v2Monty Taylor2015-09-211-0/+186
|/ | | | | | | | | | | We have it for v1, but v2 is the future. There are two differences, things in v2 do not go into a properties dict, and the actual image data needs to get uploaded as a second step. Closes-Bug: 1405562 Co-Authored-By: Niall Bunting <niall.bunting@hp.com> Co-Authored-By: Sean Perry <sean.perry@hp.com> Change-Id: If7b81c4a6746c8a1eb0302c96e045fb0f457d67b
* add image member commands for image APIchengkunye2015-07-202-0/+170
| | | | | | | | | This commit adds the following commands: image project add image project remove Closes-Bug: 1402420 Change-Id: I07954e9fa43a3ad6078dd939ecedf9f038299e7b