summaryrefslogtreecommitdiff
path: root/tests/test_swiftclient.py
Commit message (Collapse)AuthorAgeFilesLines
* Add functional tests for python-swiftclientChristian Schwede2014-05-051-1154/+0
| | | | | | | | | Coverage for swiftclient.client is 71% with these tests. Unit tests have been moved into another subdirectory to separate them from functional tests. Change-Id: Ib8c4d78f7169cee893f82906f6388a5b06c45602
* Fix up StringIO use in tests for py3Samuel Merritt2014-04-231-4/+3
| | | | | | | | | Some spots in this file were already referencing six.StringIO, but some were still using StringIO.StringIO, which does not work on py3. This patch just makes them all use six.StringIO and removes the now-unused (and wrong, on py3) import. Change-Id: I3c7311c3983f4eb409eedb6f85ede6ffe4059e63
* Fix test_raw_upload testChmouel Boudjnah2014-04-171-5/+11
| | | | | | | | | We were testing the test but we were not testing that we have actually properly uploaded the object with the right content-len (and it was broken under py3) Change-Id: Ifa91c30532090cac9f8e18ff18eaf5e6c98737d1
* Remove validate_headersChmouel Boudjnah2014-04-171-20/+0
| | | | | | It wasn't used anymore since moved up to requests (and it fails in py3). Change-Id: Ic8a80ae09ca6445696a9cf34ffb503c5ff51bc79
* Merge "Fix swiftclient.client.quote() for Python 3"Jenkins2014-04-161-4/+8
|\
| * Fix swiftclient.client.quote() for Python 3Victor Stinner2014-04-071-4/+8
| | | | | | | | | | | | | | | | | | On Python 3, urllib.parse.quote() accepts bytes and str (unicode) types and always return str (unicode). Add also more tests with non-ASCII characters. Change-Id: I8e0f19da7240e874392327d0da074ed4abb7d213
* | Merge "Add requests related unit-tests"Jenkins2014-04-141-0/+81
|\ \
| * | Add requests related unit-testsTristan Cacqueray2014-04-051-0/+81
| | | | | | | | | | | | | | | | | | | | | This change improves unit tests of the new code added by the port to requests. Raw upload and chunked upload in put_object are now covered. Change-Id: I995b23a74bc4b00bf5761362b1f1405bb8662311
* | | Merge "Python 3: fix tests on HTTP headers"Jenkins2014-04-101-7/+14
|\ \ \ | |_|/ |/| |
| * | Python 3: fix tests on HTTP headersVictor Stinner2014-04-041-7/+14
| |/ | | | | | | | | | | | | | | | | HTTP headers are encoded to bytes. Store headers at (key, value) tuples instead of Unicode strings. Check also that non-ASCII Unicode headers are encoded to UTF-8. Change-Id: Ie45f5a5ba63f539a723a7ac5649779d8efb3e912
* | Merge "Use the standard library's copy of mock when it's available."Jenkins2014-04-051-1/+6
|\ \ | |/ |/|
| * Use the standard library's copy of mock when it's available.Alex Gaynor2014-03-311-1/+6
| | | | | | | | Change-Id: Id6a31157582efe47cc3a74e6658679c2bec14767
* | Merge "set user-agent header"Jenkins2014-04-011-0/+42
|\ \ | |/ |/|
| * set user-agent headerJohn Dickinson2014-03-301-0/+42
| | | | | | | | Change-Id: Ia67807667b4b5177d83cce9fcf16d98dc5024fbc
* | Merge "Python 3: Get compatible types from six"Jenkins2014-03-301-6/+9
|\ \
| * | Python 3: Get compatible types from sixVictor Stinner2014-03-281-6/+9
| |/ | | | | | | | | | | | | | | | | | | | | * Replace unicode with six.text_type * Replace basestring with six.string_types * The long type doesn't exist in Python 3 anymore: replace 1L with long(1) and only test this type with Python 2 * Fix quote(): quote the URL if the string is a byte string. Use "bytes" type instead of "str" to be Python 3 compatible. Change-Id: I1df5aa85e4e7d07191fb5c654d52fc4bd8b9f440
* | Python 3: Fix module names in importVictor Stinner2014-03-281-5/+6
|/ | | | | | Use six.moves to fix imports on Python 3. Change-Id: I35b9405690e9f0607b24d79aa7c00830df954c41
* Replace dict.iteritems() with dict.items()Victor Stinner2014-03-271-1/+1
| | | | | | | | | | dict.iteritems() has been removed in Python 3. In Python 2, dict.items() creates a temporary list, but Samuel Merritt wrote: "The size of the data is small enough that we don't need to worry about the memory consumption; it's all just HTTP headers." Change-Id: Iac427b8bbd032e4a1efb2bdc84a3968217eb6ddf
* Use six.StringIO instead of StringIO.StringIOzhang-jinnan2014-03-031-3/+3
| | | | | | Keep Python 3.x compatibility Change-Id: If7a8f0630bd2582ca9488313dcc59805c2ce1835
* Fix --insecure option on auth2.0.1John Dickinson2014-02-131-3/+20
| | | | Change-Id: Ibe76d98d6075b84cbdb370b48f3498ab848142ad
* Port to python-requestsTristan Cacqueray2014-02-121-14/+25
| | | | | | | | | | | | | | | | | | | | | Currently, httplib implementation does not support SSL certificate verification. This patch fixes this. Note that ssl compression parameter and 100-continue thing is still missing from requests, though those are lower priority. Requests now takes care of: * proxy configuration (get_environ_proxies), * chunked encoding (with data generator), * bulk uploading (with files dictionary), * SSL certificate verification (with 'insecure' and 'cacert' parameter). This patch have been tested with requests 1.1.0 (CentOS 6) and requests 2.2.1 (current version). Change-Id: Ib5de962f4102d57c71ad85fd81a615362ef175dc Closes-Bug: #1199783 DocImpact SecurityImpact
* Merge "Add capabilities option"Jenkins2014-01-311-0/+28
|\
| * Add capabilities optionFabien Boucher2014-01-171-0/+28
| | | | | | | | | | | | | | | | This patch adds a capabilities option on swiftclient. This option uses the new /info endpoint to request the remote capabilities and nicely display it. Change-Id: Ie34b454511d5527e402e66e1fdb72120f427f2fd
* | retry on ratelimitJohn Dickinson2013-12-231-0/+18
|/ | | | | | | | | Added a retry_on_ratelimit parameter to the Connection class so that ratelimited requests can be retried. DocImpact Change-Id: I2817a7ea0ed2d69a7659e80111fbd2c91a75d530
* Merge "Don't crash when header is value of None"Jenkins2013-12-071-0/+5
|\
| * Don't crash when header is value of NoneChmouel Boudjnah2013-12-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Before commit 7d88d14d (http://git.io/hhJWdQ) swifclient used to accept header value with the type None : {'Headers': None} It would just be happy with it with those None headers and not process them, reinstate the old behavior. Closes-Bug: 1256441 Change-Id: Ic7f80c38ef2ce9ef1687ed0d6d65521f2e754905
* | Merge "Add close to swiftclient.client.Connection"Jenkins2013-11-291-0/+25
|\ \ | |/ |/|
| * Add close to swiftclient.client.ConnectionFeng Liu2013-10-231-0/+25
| | | | | | | | Change-Id: I2f5fa9c46886607a9ba99e8915ea84ac4975d004
* | Merge "Add verbose output to all stat commands"Jenkins2013-11-211-20/+0
|\ \ | |/ |/|
| * Add verbose output to all stat commandsClay Gerrard2013-10-091-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | When you stat a container or object with the verbose flag the full path of the reousrce will be displayed with the token similarlly to how an account stat displays the auth url and token. * move some logic out of bin/swift.st_stat to test it * new module swiftclient.commnad_helpers for code you want to test * moved prt_bytes into swiftclient.utils to test it * fixed IndexError with prt_bytes on sizes >= 1024Y Change-Id: Iaaa96e0308b08c554205b0055b8a04de581fefa4
* | enhance swiftclient loggingLeah Klearman2013-10-171-0/+55
|/ | | | | | | | | | * log to debug for successes and info for errors * remove dead code, neither body or raw_body are sent in kwargs * include resp.reason and response headers in logging * remove trailing \n in logging. users who want them can set logging.basicConfig(format=FORMAT) * add --info option to swift cli Change-Id: If07af46cb377f3f3d70f6c4284037241d360a8b7
* assertEquals is deprecated, use assertEqual (H602)Dirk Mueller2013-09-301-40/+40
| | | | Change-Id: I75dac8693c079a153004f77dc1cda48f3ac6f51d
* Merge "Added headers argument support to get_object()"Jenkins2013-08-021-0/+20
|\
| * Added headers argument support to get_object()Stanislav Vitkovskiy2013-07-291-0/+20
| | | | | | | | | | | | | | | | With this change conditional and range GETs are possible, as documented in official API guide: http://docs.openstack.org/api/openstack-object-storage/1.0/content/retrieve-object.html Change-Id: Ib2ed1c21e8d3f1ed79c0b7e542ee022ee535835c
* | Assignment to reserved built-in symbol "file"Wu Wenxiang2013-08-021-4/+4
|/ | | | | | | | | In file: tests/test_swiftclient.py, test_unicode_ok() & test_chunk_warning() Fixes bug #1207736 Change-Id: I0a822802ec8910e9aec36ae5af775f8abb384d34
* Merge "python3: Start of adding basic python3 support."Jenkins2013-07-231-1/+1
|\
| * python3: Start of adding basic python3 support.Chuck Short2013-07-181-1/+1
| | | | | | | | | | | | | | Fix imports so its python3 compliant. Change-Id: Ie08fe63b87e75bb099105ca1de860f9ab6c3340b Signed-off-by: Chuck Short <chuck.short@canonical.com>
* | Refuse carriage return in header valueKun Huang2013-07-121-1/+13
|/ | | | | | | | | | | | | | | | See bug #1188896. Comparing with Curl and Django, they both refuse carriage returns in header values, so the request() method on the HTTP(S)Connection instance returned by swiftclient.client.http_connection() will raise an InvalidHeadersException if any of the headers to be sent contain a newline. Drive-by fix for a couple of header values which were integers instead of strings (Content-Length getting set to zero). Fixes bug #1188896 Change-Id: Ic6afdb92882284f843aacb06d20f682ddcb47151
* Allow storage url override for both auth vers.Darrell Bishop2013-07-051-0/+32
| | | | | | | | | | | | | | | | | | | | When --os-storage-url is specified on the command-line to bin/swift, it will override the used storage URL regardless of authentication for both authentication version 1 and version 2. This can be used to bypass a load-balancer to hit a specific proxy server for testing/debugging purposes. Within the client library, this feature is accessed by passing the desired storage URL into swiftclient.client.Conection.__init__() via the os_options keyword argument. For example: conn = Connection(auth_url, user, key, os_options={ 'object_storage_url': 'http://overridden.storage.url/AUTH_foo'}) This patch also adds a dependency on mock>=0.8.0, which is the same as openstack/swift. Change-Id: Id2a36ed6abffd65e7762b6beea5bbfc6c036e848
* Add option to disable SSL compressionStuart McLaren2013-06-041-3/+5
| | | | | | | | | | | Allows optionally disabling SSL compression. This can significantly improve HTTPS upload/download performance in some cases -- in particular when the object is not compressible and you have very high network bandwidth. Implements blueprint ssl-compression. Change-Id: I1260055f9c2e83cdabfeb51aed11b3899bed4d55
* Add end_marker and path query parametersYUZAWA Takahiko2013-05-051-0/+62
| | | | | | Fix Bug 1175057 Change-Id: I1bf65fa7c4d99ddb03dd183fe3862df93455f501
* Switch to flake8.Monty Taylor2013-05-011-13/+13
| | | | Change-Id: Ib9ba1e7eed09c5a90c558a8365d0a87c3f4b5ee5
* Improve Python 3.x compatibilityDirk Mueller2013-04-291-4/+4
| | | | | | | | Some mechancical replacement of the deprecated except x,y: construct with except x as y, which works with any Python version >= 2.6 Change-Id: Ic245049dc7b408a5c89b9e27dfd2bd7c08acc5b5
* Merge "Static large object support."1.4.0Jenkins2013-04-041-1/+22
|\
| * Static large object support.David Goetz2013-04-031-2/+22
| | | | | | | | | | | | | | | | Also fixed bug with current large objects with segment listing prefixes. Allow retry for object PUTs when possible. Change-Id: I0edff127fd5d5c53da33aa7cb76a4f4dc85bf6e6
* | Fixed pep8 errors in test directory.jola-mirecka2013-03-221-31/+24
|/ | | | | | | | | | | Files test_swiftclient.py and utils.py had all pep8 errors fixed. Also added tests directory to tox.ini file, so that pep8 would monitor tests directory by default. Change-Id: Id60a2cd88bd814d1dcbeca951764c9d236500837 Fixes: bug #1158819
* Enhance put_object to inform when chunk is ignoredjola-mirecka2013-03-061-0/+21
| | | | | | | | | | | | | | Changed documentation for chunk_size parameter to indicate that it can be used only with file like objects. Also added a UserWarning when using a string contents to inform that chunk_size will be ignored. Added a unit test to check whether the warning is working correctly. Fixes: bug #1147232 Change-Id: I618ec45520ba81905ce2ead4d61f192d21ae3489
* Add env[SWIFTCLIENT_INSECURE]You Yamagata2013-01-101-0/+20
| | | | | | | | Add env[SWIFTCLIENT_INSECURE] as default of --insecure option. If set to 'true', allow to access insecure keystone server. The name follows 'NOVACLIENT_INSECURE' in novaclient. Change-Id: I322674eba9c07e6def97bce339815fa15191a92d
* Use testtools as base class for test cases.Monty Taylor2012-12-261-5/+11
| | | | | | Part of blueprint grizzly-testtools Change-Id: Iff9aac184a115df9b396e218209962e6897a32d9
* Add --os-cacertDean Troyer2012-12-201-0/+29
| | | | | | | | | Add support to specify a ca certificate bundle to verify keystone TLS (https) certificates. This only verifies certificates on the keystone connection, swift https connections are unchanged. Change-Id: I14351b405af4fd3d1970ba6656c1282a5d0a1082