This test unit pretends to cover attempts to upload images with active
status.
Change-Id: Id557157b30d78af474973a9d385c34aeb8afd0c3
Closes-Bug: #1434306
Deleting an already deleted image using admin user is throwing an
error "404 Not Found" which is confusing. Deleting an image that does
not exist throws "No image with a name or ID of 'image-id' exists."
Updated the code so that trying to delete an already deleted image
throws "No image with an ID of 'image-id' exists." error.
Closes-Bug: #1333119
Change-Id: I8f9a6174663337a0f48aafa029a4339c32eb2134
Co-Authored-By: Abhishek Talwar <abhishek.talwar@tcs.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
Previously, some tests caused the usage options for glance to be printed out to
stderr. This patch redirects the stderr output for those unnecessarily verbose
test functions.
Change-Id: I781d35a16a97c9c093cb17288ebd96d3e1a2e4e9
Closes-Bug: #1334655
Remove all deprecated commands from the shell
since they are no longer used and to keep
the command line menu from looking cluttered.
Closes-bug: #1314218
Change-Id: I66e82872988e3835e4f290f48dfc80538271426c
This review implements blueprint python-request and replaces the old
http client implementation in favor of a new one based on
python-requests.
Major changes:
* raw_request and json_request removed since everything is now being
handled by the same method "_request"
* New methods that match HTTP's methods were added:
- get
- put
- post
- head
- patch
- delete
* Content-Type is now being "inferred" based on the data being sent:
- if it is file-like object it chunks the request
- if it is a python type not instance of basestring then it'll try
to serialize it to json
- Every other case will keep the incoming content-type and will send
the data as is.
* Glanceclient's HTTPSConnection implementation will be used if
no-compression flag is set to True.
Co-Author: Flavio Percoco<flaper87@gmail.com>
Change-Id: I09f70eee3e2777f52ce040296015d41649c2586a
Add the type to the parameters that require an integer
in the V1 shell to avoid sending an improper request.
Change-Id: Idb1ed39b11ca737fdd42d24e297c142f28dce35c
On assertEqual, the order of parameters should be (expected, observed).
But, some part of glanceclient v1 test were written with invalid order.
This patch fixes this problem.
Change-Id: If361309041a257c56bfc1fbbccf1b905839b0c18
Partially-bug: #1277104
Add a new module that contain generic wrapper for file and iterator, which
are used to wrap image to upload and the request body iterator in upload and
download cases repectively, to show and advance a pretty progress bar when this
laters are consumed, The progress bar is triggered by adding a --progress command
line argument to commands: image-create, image-download or image-update.
Change-Id: I2ba42fd0c58f4fa087adb568ec3f08246cae3759
bug fix: LP#1112309
blueprint: progressbar-when-uploading
Instead of globally ignoring pyflakes and
hacking warnings, only blacklist those that trigger
very frequently so far, in order to clean them
up in followup commits. Fix and start gating
on the rest already.
Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
For image-updae and image-create commands, glanceclient attempts to
determine whether image data should be uploaded based on the presence
of data on stdin. Unforunately it is difficult to determine if data is
available, especially when standard in is from a pipe.
This is especially problematic for update operations, where data must
only be uploaded if the image is in queued state. For example data may
be uploaded when the user only wants to rename an image, but the rename
will be rejected because data cannot be uploaded to an unqueued image.
This patch removes the check that attempts to determine if data is
available to read as it didn't work for pipes. It also re-introduces a
check for image state in the update operation, so that glanceclient only
attempts to read data if the image being updated is in queued state.
The image state check is part of the original patchset that was removed
so the patchset could have a single focus [1]
This patch also removes a test for handling empty stdin, and adds a test
for reading stdin from a pipe.
[1] https://review.openstack.org/#/c/27536/3/glanceclient/v1/shell.py
Fixes: bug 1184566
Related to: bug 1173044
Change-Id: I8d37f6412a0bf9ca21cbd75cde6a4d5a174e5545
* Check for available data size in v1/shell.py/_set_data_field, don't
read if 0.
* Add test_shell.py including tests for 3x stdin scenarios:
* closed
* open and empty
* open with data
Change-Id: I6ff65b0e226be509de9cd3f021560081529283b0
Fixes: bug #1173044
Add unittests for the following modules:
* glanceclient.shell
* glanceclient.v1.shell
* glanceclient.v1.legacy_shell
* glanceclient.v2.shell
Also add mock library to the tools/test-requires
Implements: blueprint glanceclient-shells-unittests
Change-Id: I5ec527c5efff3726932d234d7c67e08149643f89