summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix Python3 bugs2.1.0Christian Schwede2014-05-212-2/+20
| | | | | | | | | | | | | | | | | | | | This patch fixes three issues that were found running functional tests with Python 3: 1. python-requests sets 'application/x-www-form-urlencoded' as content-type if the input is not a string object and no content-type is given. 2. Encoding of the headers is now only done if required. This prevents comparisons between unencoded headers and encoded prefixes and avoids unnecessary forloop-iterations. One unittest was extended to ensure it works for unencoded and encoded headers with or without the prefix. 3. Functional tests recently switched to using byte data for testing, thus the comparison needs to be a byte object as well. Change-Id: I035f8b4b9c9ccdc79820b907770a48f86d0343b4
* Move test_shell.py under tests/unit/anc2014-05-201-0/+0
| | | | | | | | | Looks like test_shell.py got left behind when the unit tests were relocated under tests/unit. As a consequence they weren't included in tox runs. Change-Id: I93435e6141c5e3ad4a9403626f226d7c760cbd7c
* change assert_ to assertTrueChristian Berendt2014-05-141-1/+1
| | | | | | | According to http://docs.python.org/2/library/unittest.html assert_ is a deprecated alias of assertTrue. Change-Id: I18db0af72934dde4498502fb29579941d020cf01
* Merge "Only encode metadata for user customed headers"Jenkins2014-05-081-6/+6
|\
| * Only encode metadata for user customed headersChmouel Boudjnah2014-05-071-6/+6
| | | | | | | | | | | | | | | | | | | | Don't encode standard headers keys but just the x-*-meta- ones. That fixes py3 to not have them casted as bytes and not properly passed to the requests kwargs. Other trivial py3 fixes along the way. Change-Id: I91b95f32fb2aec9b20892a5bb95fd1bc65d002f3
* | Make the function tests Python3-import friendlyAlex Gaynor2014-05-071-6/+7
|/ | | | Change-Id: Ic73fc2a6f6712505eda71fa2e2e91ac680ced9a3
* Merge "Add functional tests for python-swiftclient"Jenkins2014-05-069-0/+306
|\
| * Add functional tests for python-swiftclientChristian Schwede2014-05-059-0/+306
| | | | | | | | | | | | | | | | | | 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
* | Mock auth_end_time in test_shell.test_downloadChmouel Boudjnah2014-04-251-10/+14
|/ | | | | | | | If we don't we are getting an error like this under py3: TypeError: unsupported operand type(s) for /: 'float' and 'MagicMock' Change-Id: If5a6947757297354e6b81fc45f011cc2921d609f
* Merge "Fixed several shell tests on Python3."Jenkins2014-04-241-0/+5
|\
| * Fixed several shell tests on Python3.Alex Gaynor2014-04-231-0/+5
| | | | | | | | | | | | | | They currently fail because on Python3 arbitrary objects cannot be compared, in this case, MagicMock and int. In Python2 these comparisons silently pass. Change-Id: I468c2137702a454365886099e827d329cb1d7209
* | Merge "Fix up StringIO use in tests for py3"Jenkins2014-04-241-4/+3
|\ \
| * | 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
* | Merge "Updated test_shell for Python3"Jenkins2014-04-231-2/+10
|\ \ | |/ |/|
| * Updated test_shell for Python3Alex Gaynor2014-04-231-2/+10
| | | | | | | | Change-Id: Ia76e544fa6e0a222c260191a1ab74939078ed2fb
* | Merge "Fix test_raw_upload test"Jenkins2014-04-231-5/+11
|\ \ | |/ |/|
| * 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
* | Merge "Remove validate_headers"Jenkins2014-04-231-20/+0
|\ \ | |/
| * 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 "Add tests for bin/swift"Jenkins2014-04-181-0/+319
|\ \ | |/ |/|
| * Add tests for bin/swiftChristian Schwede2014-04-141-0/+319
| | | | | | | | | | | | | | Tests are written to ensure bin/swift is working properly and using functions from swiftclient modules as expected. Change-Id: Idb0581516b7e0a41c97977bb0bb9f8290f67ad13
* | Merge "Fix test_multithreading on Python 3"Jenkins2014-04-161-3/+9
|\ \
| * | Fix test_multithreading on Python 3Victor Stinner2014-04-151-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * On Python 3, the printer doesn't encode Unicode to utf8 anymore, since print() expects a Unicode string. * Update unit tests for Python 3 since repr() doesn't escape non-ASCII characters in Unicode strings anymore: http://legacy.python.org/dev/peps/pep-3138/ Change-Id: I89471019d691a46651312d6a49964b719192148a
* | | 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-053-3/+17
|\ \ | |/ |/|
| * Use the standard library's copy of mock when it's available.Alex Gaynor2014-03-313-3/+17
| | | | | | | | 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-283-11/+12
|/ | | | | | Use six.moves to fix imports on Python 3. Change-Id: I35b9405690e9f0607b24d79aa7c00830df954c41
* Merge "Python 3: cast map() result to list"Jenkins2014-03-281-3/+3
|\
| * Python 3: cast map() result to listVictor Stinner2014-03-241-3/+3
| | | | | | | | | | | | | | | | | | | | On Python 3, map() returns a generator, not a list. Cast explicitly the result of map() to a list to get a list on Python 2 and Python 3. The cast is useless in Python 2, but it doesn't hurt performances: it's just a unit test. Change-Id: I87486b7dbc42507a6fd7886748a2e09735b6fc5b
* | Merge "Python 3: Fix tests using temporary text files"Jenkins2014-03-281-2/+2
|\ \
| * | Python 3: Fix tests using temporary text filesVictor Stinner2014-03-241-2/+2
| |/ | | | | | | | | | | | | Use mode "w" instead of the default mode "wb+" to get text file instead of binary file on Python 3. Change-Id: I2efe8d926309cfcd5ffe4ea963c11799773def73
* | Merge "Python 3: Replace iter.next() with six.next(iter)"Jenkins2014-03-281-4/+4
|\ \
| * | Python 3: Replace iter.next() with six.next(iter)Victor Stinner2014-03-271-4/+4
| |/ | | | | | | | | | | Use six.next() to be Python 3 compatible. Change-Id: Ia16148a759d368872787d5896a7b1dc42ffcdfb5
* | 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-032-4/+4
| | | | | | Keep Python 3.x compatibility Change-Id: If7a8f0630bd2582ca9488313dcc59805c2ce1835
* Add LengthWrapper in put_object to honor content_length paramClay Gerrard2014-02-251-0/+41
| | | | | | Closes-Bug:#1284360 Change-Id: Iec63a3fde77bb8195bfe46c764403b367999ff43
* Fix --insecure option on auth2.0.1John Dickinson2014-02-132-3/+24
| | | | Change-Id: Ibe76d98d6075b84cbdb370b48f3498ab848142ad
* Port to python-requestsTristan Cacqueray2014-02-123-97/+28
| | | | | | | | | | | | | | | | | | | | | 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 "assertEquals is deprecated, use assertEqual"Jenkins2014-01-311-41/+41
|\
| * assertEquals is deprecated, use assertEqualDirk Mueller2014-01-171-41/+41
| | | | | | | | Change-Id: I226d9046d25d681beea60d38b029b71f9e6bf86c
* | Merge "Add capabilities option"Jenkins2014-01-311-0/+28
|\ \