summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Move unit tests to standard directoryStuart McLaren2015-04-1831-8202/+0
| | | | | | | | | | | | | This patch moves the glanceclient unit tests to the standard directory (xxxclient/tests/unit) in preparation for adding functional gate tests 'check-glanceclient-dsvm-functional' in the same vein as existing client tests for other projects, eg: * check-novaclient-dsvm-functional * check-keystoneclient-dsvm-functional * check-neutronclient-dsvm-functional Change-Id: I29d4b9e3a428c851575ee9afde40d6df583456c4
* Merge "Fix https stack trace on python 3.4 client"Jenkins2015-04-151-7/+0
|\
| * Fix https stack trace on python 3.4 clientStuart McLaren2015-04-111-7/+0
| | | | | | | | | | | | | | | | | | | | | | When using the client with python 3.4 and no ssl compression the following stack trace ocurrs: TypeError: startswith first arg must be bytes or a tuple of bytes, not str Closes-bug: 1442883 Related-bug: 1357430 Change-Id: I8e28f0bb1f3e866f11851247ce31470ca8c2af4f
* | Merge "Fix client when using no ssl compression"Jenkins2015-04-151-0/+42
|\ \ | |/
| * Fix client when using no ssl compressionStuart McLaren2015-04-111-0/+42
| | | | | | | | | | | | | | | | | | | | | | Since the release of the 0.16.1 client, using the 'no ssl compression' option, whether on the command line, or via the library -- Nova does this by default -- a stack trace was generated. Closes-bug: 1442664 Related-bug: 1357430 Change-Id: I2b8ddcb0a7ae3cfccdfc20d3ba476f3b4f4ec32d
* | Merge "Add unit tests for log_curl_request"Jenkins2015-04-151-0/+95
|\ \
| * | Add unit tests for log_curl_requestMichal Dulko2015-04-141-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add 5 new tests that check if log_curl_request method produces proper curl commands and add again an old test checking this method for unicode support. Change-Id: I64caad18d537d727835f3a7ada010ec45b20638a Closes-Bug: 1174339
* | | Merge "Add SSL cert verification regression tests"Jenkins2015-04-141-21/+108
|\ \ \ | |/ / |/| / | |/
| * Add SSL cert verification regression testsStuart McLaren2015-04-111-21/+108
| | | | | | | | | | | | | | | | | | | | | | A security bug (1357430) was introduced which meant that SSL certificate verification was not occurring. Add new tests which help prevent the 'requests' part of bug 115260 recurring. Change-Id: Iaf56fd8bc34fa8f35c2fd7051f9f8424002352cf Related-bug: 1357430
* | Merge "Test unit for checking update active images"Jenkins2015-04-131-0/+15
|\ \ | |/ |/|
| * Test unit for checking update active imagesVictor Morales2015-03-191-0/+15
| | | | | | | | | | | | | | | | This test unit pretends to cover attempts to upload images with active status. Change-Id: Id557157b30d78af474973a9d385c34aeb8afd0c3 Closes-Bug: #1434306
* | Merge "Validate tag name when filtering for images"Jenkins2015-04-091-1/+7
|\ \
| * | Validate tag name when filtering for imagesKamil Rykowski2015-03-261-1/+7
| |/ | | | | | | | | | | | | | | | | | | | | Right now all invalid tags are skipped when filtering for image list. We should change this behaviour to raise an exception when invalid tag value is provided. Additionally remove misplaced `pass` from one of the tests. Closes-Bug: 1433962 Change-Id: If5148608a70ee019697ea2dcb84e19a53222d596
* | Merge "glance image-show now have --human-readable option"Jenkins2015-04-081-1/+22
|\ \
| * | glance image-show now have --human-readable optionyatin karel2015-03-221-1/+22
| |/ | | | | | | | | | | | | | | Added option '--human-readable' to image-show cli which allows users to display image size in human-readable format. Change-Id: Ic3452ce4560d3cf90fa7f59f98e5ff42e804f8c9 Closes-Bug: #1434381
* | Merge "Creating task with invalid property crashes in py3"Jenkins2015-04-071-0/+8
|\ \
| * | Creating task with invalid property crashes in py3Kamil Rykowski2015-04-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when you are trying to set invalid additional property for task using py3 interpreter it will fail, because function `unicode` does not exist in py3. Fix it by replacing `unicode` with `utils.exception_to_str` which is used in other modules already. Change-Id: I5897868f801467a2eaa7585b5f2d578cef358426 Closes-Bug: 1439513
* | | Merge "Expose 'is_base' schema property attribute"Jenkins2015-04-021-0/+18
|\ \ \ | |/ / |/| |
| * | Expose 'is_base' schema property attributeAlexander Tivelkov2015-03-271-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changeset I49255255 has added an 'is_base' attribute for Image Schema properties, thus allowing to differentiate between base and custom image properties, but the client hasn't make any use of it. This patch adds appropriate attribute to SchemaProperty class and a helper method which allows to validate if the given property is base or not. The added helper method (is_base_property) should not be confused with the existing is_core_property: the latter just checks if the property is known to the schema, regardless of its being base or not. Change-Id: I7c397196dad9ae5494ed2f8f3aacef3fc1ce70d8 Partial-Bug: #1323660
* | | Stub authentication requests rather than pluginsJamie Lennox2015-03-281-54/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than testing that a certain plugin was loaded test to make sure that the client actually did the authentication request and that the content of that request was correct. This means we are not so tightly bound to those specific plugins and this can be changed in later reviews. Change-Id: Ia3ae0069e3e0277d655f0e251196eca658f94c75
* | | Remove keystoneclient mocksJamie Lennox2015-03-282-244/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The majority of the mocks on keystoneclient are not needed. Instead we use the fixtures that keystoneclient provides to create well formed responses and use requests_mock to stub out those values when accessed. This is a closer to real usage pattern and the way that most client projects are now handling keystoneclient auth. Change-Id: I294aca1d11c9c5cfb4b82ad16476af4000efee1c
* | | Replace mox in tests with requests-mockJamie Lennox2015-03-281-125/+56
|/ / | | | | | | | | | | | | | | requests-mock is a tool specifically designed for mocking responses from the requests library. Use that instead of handling mox and mock ourselves. Change-Id: Ifd855b8d6c1b401e29ac210593c48d2da87a571b
* | Remove redundant FakeSchemaAPI __init__ methodKamil Rykowski2015-03-261-3/+0
|/ | | | | | | | | | | Currently, the FakeSchemaAPI in tests/utils has an overriden __init__ method which simply calls super of FakeAPI and doesn't perform any extra operations. This is redundant, because same effect will be achieved when __init__ definition is omitted in FakeSchemaAPI. Additionally it uses 'cls' as first param instead of 'self' which breaks naming convention. Change-Id: I3e72adfbc7b67076748f640d74507ff28c6060d7 Closes-Bug: 1418508
* Merge "Extend images CLI v2 with new sorting syntax"Jenkins2015-03-162-3/+87
|\
| * Extend images CLI v2 with new sorting syntaxMike Fedosin2015-03-162-3/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code enables new syntax for sorting output with multiple keys and directions based on API Working group sorting guidelines. It's a client code to consume API modified in change Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb Example: glance --os-image-api-version 2 --sort name:desc,size:asc Implements-blueprint: glance-sorting-enhancements DocImpact Depends-On: Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb Change-Id: I36a9fa9f0508fea1235de2ac3a0d6a093e1af635
* | Merge "Add the ability to specify the sort dir for each key"Jenkins2015-03-162-7/+66
|\ \ | |/
| * Add the ability to specify the sort dir for each keyMike Fedosin2015-03-162-7/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds client code to consume API modified in change Ib43b53abfba7cb5789d916a014376cf38fc5245b Extends CLI for v2 with multiple sort dirs Example: glance --os-image-api-version 2 image-list \ --sort-key name --sort-dir asc --sort-key size --sort-dir desc Implements-blueprint: glance-sorting-enhancements DocImpact Depends-On: Ib43b53abfba7cb5789d916a014376cf38fc5245b Change-Id: Ia20716f3c75299f796879299da317b2e81496088
* | Merge "Adds the ability to sort images with multiple keys"Jenkins2015-03-162-3/+112
|\ \ | |/
| * Adds the ability to sort images with multiple keysMike Fedosin2015-03-132-3/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds client code to consume API modified in change Ib7a6aeb2df3bc5d23fe8e070290b5bfcab00c0f5 Extends CLI for v2 with multiple sort keys Example: glance --os-image-api-version 2 image-list --sort-key name --sort-key size Implements-blueprint: glance-sorting-enhancements Change-Id: If79779a4c52c8dc5c4f39192d3d247335a76ba24 DocImpact Closes-Bug: 1221274
* | Apply expected patch format when updating tags in v2.imagesSteve Lewis2015-03-122-4/+37
|/ | | | | | | | | | | | Currently, glanceclient.v2.update builds a patch request that does not match glance API. This patch overrides the default behaviour to customize the patch request with the right format for the API. Co-Authored-By: Steve Lewis <steve.lewis@rackspace.com> Fixes bug 1306774 Change-Id: If0739ac285da1e741bfa40b6c719331a5ce49319
* Merge "Unit tests covering missing username or password"Jenkins2015-03-101-2/+50
|\
| * Unit tests covering missing username or passwordMichal Dulko2015-02-091-2/+50
| | | | | | | | | | | | | | | | | | | | | | | | After fixing message displayed when client is executed without required environment variables exported (OS_USERNAME, OS_PASSWORD, OS_PROJECT_NAME, OS_AUTH_URL) regression tests should be added. I've also fixed an issue causing tests using make_env method to always use FAKE_V2_ENV, even in ShellTestWithKeystoneV3Auth. Change-Id: I800c8fa11ee45d19f179bd030426db86a93d9f6a Closes-Bug: 1419788 Partial-Bug: 1355252
* | Merge "v2: Allow upload from stdin on image-create"Jenkins2015-03-061-4/+14
|\ \
| * | v2: Allow upload from stdin on image-createStuart McLaren2015-01-071-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example: $ glance --os-image-api-version 2 image-create < /tmp/data This is consistent with v1. DocImpact Closes-bug: 1408033 Change-Id: Ifed4ece9e4e02a46d80b49a8e4fc372f1a304241
* | | Merge "Unify using six.moves.range rename everywhere"Jenkins2015-03-041-0/+2
|\ \ \
| * | | Unify using six.moves.range rename everywhereErno Kuvaja2015-02-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mainly to improve consistency, use range() from six.moves renames across glance. Behaves consistently like py2 xrange() and py3 range(). Change-Id: I7c573a3a9775f454b98d25f2a14f8e9f5f4ac432
* | | | Merge "https: Prevent leaking sockets for some operations"Jenkins2015-03-041-9/+12
|\ \ \ \
| * | | | https: Prevent leaking sockets for some operationsStuart McLaren2015-02-181-9/+12
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other OpenStack services which instantiate a 'https' glanceclient using ssl_compression=False and insecure=False (eg Nova, Cinder) are leaking sockets due to glanceclient not closing the connection to the Glance server. This could happen for a sub-set of calls, eg 'show', 'delete', 'update'. netstat -nopd would show the sockets would hang around forever: ... 127.0.0.1:9292 ESTABLISHED 9552/python off (0.00/0/0) urllib's ConnectionPool relies on the garbage collector to tear down sockets which are no longer in use. The 'verify_callback' function used to validate SSL certs was holding a reference to the VerifiedHTTPSConnection instance which prevented the sockets being torn down. Change-Id: Idb3e68151c48ed623ab89d05d88ea48465429838 Closes-bug: 1423165
* | | | Fix tests failing if keystone is running locallyLouis Taylor2015-03-021-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mocks out the call to python-keystoneclient's Session.get_token(), preventing any actual calls being made to a keystone service, running or not. Change-Id: I24b0874d8e67b46b7c2294d4ac54efa861561dff Closes-bug: 1423170
* | | | Merge "Strip json and html from error messages"Jenkins2015-03-011-0/+43
|\ \ \ \
| * | | | Strip json and html from error messagesd34dh0r532015-02-161-0/+43
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error messages were being passed with either JSON or HTML formatting leading to an unpleasant user experience. This strips the JSON or HTML tags and presents the clean error message to the user. Rewrote the lispy function to be more pythonic, added test cases and cleaned up some pep8 violations. Removed commented out cruft from a previous version of this patch. Changed the HTML details from a set to a list in order to ensure the ordering of the exception details. Added code to eliminate the duplicate detail messages from the list and reordered the assertion string to match actual output. Refactored duplicate elimination code to be more readable and reliable. Some reworking of the duplication elimination loop to make it more readable. Removed unneeded conditional to filter out empty elements. Change-Id: I79985b3e305cb30328a3c16b025315a8e969243d Closes-Bug: 1398838
* | | | Merge "Register our own ConnectionPool without globals"Jenkins2015-02-261-4/+4
|\ \ \ \ | |_|_|/ |/| | |
| * | | Register our own ConnectionPool without globalsIan Cordasco2015-02-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, on systems like Fedora and Debian, it is possible to import urllib3 as well as requests.packages.urllib3. They functionally point to the same code but sys.modules considers them to be separate items. When downstream packagers unvendor urllib3 from requests, they also change all the imports inside of the package. So if the code imports urllib3 from requests.packages.urllib3 and modifies globals in a submodule, that will not be visible to requests since it has been rewritten to use urllib3 (not requests.packages.urllib3). By handling this logic ourselves, we can issue a release until upstream packages and requests can fix this and cut a new release. Change-Id: Ic77ce8a06d9d148a899b4b8695990fca8fdaefc5 Closes-bug: 1396550
* | | | Merge "Glance image delete output"Jenkins2015-02-202-0/+44
|\ \ \ \
| * | | | Glance image delete outputAbhishek Talwar2015-02-172-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | Merge "Update HTTPS certificate handling for pep-0476"Jenkins2015-02-191-0/+2
|\ \ \ \ \ | |_|_|_|/ |/| | | |
| * | | | Update HTTPS certificate handling for pep-0476James Page2014-12-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pep (included in python 2.7.9) changes the behaviour of SSL certificate chain handling to be more py3 like. Include required new exception behaviour in the list of exceptions to translate under py2. https://github.com/python/peps/blob/master/pep-0476.txt Closes-Bug: 1404227 Change-Id: I7da1a13d1ec861a07fd96684d0431508a214a2c8
* | | | | Merge "Return 130 for keyboard interrupt"Jenkins2015-02-061-0/+9
|\ \ \ \ \
| * | | | | Return 130 for keyboard interruptRakesh H S2015-02-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When keyboard interrupt is received by glanceclient, the return code as of now is 1. But since the client was terminated by an keyboard interrupt, the return code should be 130. (http://tldp.org/LDP/abs/html/exitcodes.html) It is useful when people are writing automation test cases and want to validate based on the return code. Change-Id: Ia70116ab6f0708a0ce6eeaed07c1e7a56e68c9f4 Closes-Bug: #1373231
* | | | | | Merge "Close streamed requests explicitly"Jenkins2015-02-061-0/+3
|\ \ \ \ \ \