322 Commits

Author SHA1 Message Date
Christian Schwede
eb94ac076d Add functional tests for python-swiftclient
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
2014-05-05 11:53:37 +02:00
Alex Gaynor
9ff3bad4e2 Removed a duplicate word in a dostring
Change-Id: I38e41a7ce9f91b5b1785491c6cd10dbbba9562a2
2014-04-25 11:26:28 -07:00
Chmouel Boudjnah
a99c2ff581 Don't utf8 encode urls.
This is not needed since already done by requests.

(and it was buggy with py3).

Change-Id: I9505c56be2f53eb8071aea3d5fb9d8caa9508e34
2014-04-24 17:05:36 +02:00
Jenkins
37bf0ff9a1 Merge "Fixed several shell tests on Python3." 2014-04-24 06:51:27 +00:00
Jenkins
b9bd897639 Merge "Fix up StringIO use in tests for py3" 2014-04-24 00:26:47 +00:00
Jenkins
fc66708418 Merge "Updated test_shell for Python3" 2014-04-23 23:18:50 +00:00
Alex Gaynor
c3bec04485 Fixed several shell tests on Python3.
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
2014-04-23 15:52:13 -07:00
Samuel Merritt
1353f2412b Fix up StringIO use in tests for py3
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
2014-04-23 13:04:54 -07:00
Jenkins
1893cbec88 Merge "Fix test_raw_upload test" 2014-04-23 19:58:10 +00:00
Alex Gaynor
0102e2e1ee Updated test_shell for Python3
Change-Id: Ia76e544fa6e0a222c260191a1ab74939078ed2fb
2014-04-23 11:40:37 -07:00
Jenkins
91075c3251 Merge "Remove validate_headers" 2014-04-23 16:57:24 +00:00
Jenkins
fb2058f52b Merge "Use quote/unquote from six module for py3" 2014-04-23 16:57:23 +00:00
Jenkins
cda2573ab6 Merge "Add tests for bin/swift" 2014-04-18 02:28:27 +00:00
Chmouel Boudjnah
e2b7636d66 Fix test_raw_upload test
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
2014-04-17 12:04:43 -04:00
Chmouel Boudjnah
504e5a7f53 Remove validate_headers
It wasn't used anymore since moved up to requests (and it fails in py3).

Change-Id: Ic8a80ae09ca6445696a9cf34ffb503c5ff51bc79
2014-04-17 12:04:43 -04:00
Chmouel Boudjnah
8830c81db7 Use quote/unquote from six module for py3
Change-Id: I42cff32fbf3febd6dd6a7171b9214f93b4414f9a
2014-04-17 12:04:43 -04:00
Tristan Cacqueray
fa20e7f685 Makes use of requests.Session
This allows better connection pooling and may improve performances.

Change-Id: I69e986b7387dd3ac281731b8355a3eec34a537f8
2014-04-16 16:00:17 +00:00
Jenkins
aaa563c749 Merge "Fix test_multithreading on Python 3" 2014-04-16 02:58:47 +00:00
Jenkins
c810772623 Merge "Fix swiftclient.client.quote() for Python 3" 2014-04-16 00:36:39 +00:00
Victor Stinner
ea498fb052 Fix test_multithreading on Python 3
* 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
2014-04-15 11:38:26 -04:00
Christian Schwede
f24c67cf1d Add tests for bin/swift
Tests are written to ensure bin/swift is working properly and using
functions from swiftclient modules as expected.

Change-Id: Idb0581516b7e0a41c97977bb0bb9f8290f67ad13
2014-04-14 10:41:55 -04:00
Jenkins
ec538d3720 Merge "Add requests related unit-tests" 2014-04-14 10:49:14 +00:00
Jenkins
cdd8d33ea7 Merge "Python 3: fix tests on HTTP headers" 2014-04-10 14:08:30 +00:00
Jenkins
e04bf9e093 Merge "Make bin/swift testable part 2" 2014-04-07 09:45:05 +00:00
Victor Stinner
155053ea61 Fix swiftclient.client.quote() for Python 3
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
2014-04-07 10:30:18 +02:00
Jenkins
c5cc2b7b7e Merge "Use the standard library's copy of mock when it's available." 2014-04-05 09:46:04 +00:00
Tristan Cacqueray
da2d8eef47 Add requests related unit-tests
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
2014-04-05 09:14:08 +00:00
Florent Flament
1eaf4c549f Update help message to specify unit of --segment-size option.
Change-Id: Ic3f9a733329c19c4e0bb85676da28a8d1d74232b
Closes-Bug: 1302566
2014-04-04 15:10:40 +00:00
Victor Stinner
d8cb0b9b32 Python 3: fix tests on HTTP headers
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
2014-04-04 10:57:41 +02:00
OpenStack Jenkins
fa65fbbce5 Updated from global requirements
Change-Id: I96dfa12efee068be885f8acc94175ce3b60fe827
2014-04-02 23:20:12 +00:00
Jenkins
132c643156 Merge "Removed usage of tuple unpacking in parameters." 2014-04-02 19:55:59 +00:00
Jenkins
e0fa104115 Merge "Replaced print statements with print function." 2014-04-01 23:05:22 +00:00
Jenkins
98e36e9438 Merge "don't use mutable defaults in kwargs" 2014-04-01 15:21:22 +00:00
Jenkins
cda26a32c1 Merge "set user-agent header" 2014-04-01 15:21:20 +00:00
Jenkins
296d3ed4ce Merge "Decode HTTP responses, fixes bug #1282861" 2014-04-01 14:08:34 +00:00
Alex Gaynor
4e7bc75432 Use the standard library's copy of mock when it's available.
Change-Id: Id6a31157582efe47cc3a74e6658679c2bec14767
2014-03-31 11:34:49 -07:00
Alex Gaynor
1d0c97fdb3 Replaced print statements with print function.
This is needed for Python3 compatibility.

Change-Id: Iadd21e4b3a936b601a69f1db2aba8e1597f13fc3
2014-03-30 12:56:43 -07:00
Alex Gaynor
97662952fd Removed usage of tuple unpacking in parameters.
Replaced it with traditional tuple unpacking. Needed for Python 3 support.

Change-Id: I714f32859f9b1ec7216eae777ea8968b5826af3b
2014-03-30 12:50:12 -07:00
Jenkins
21db1bf836 Merge "Python 3: Get compatible types from six" 2014-03-30 19:48:34 +00:00
John Dickinson
1f0dd002db don't use mutable defaults in kwargs
Change-Id: I3ae71259ccc49a5d8a852388784c3dfd577df50a
2014-03-30 10:29:36 -07:00
John Dickinson
4f3d6e7f3a set user-agent header
Change-Id: Ia67807667b4b5177d83cce9fcf16d98dc5024fbc
2014-03-30 10:29:07 -07:00
Victor Stinner
12f86fdcc5 Python 3: Get compatible types from six
* 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
2014-03-28 15:48:50 +00:00
Victor Stinner
e3b7ecd2bb Python 3: Fix module names in import
Use six.moves to fix imports on Python 3.

Change-Id: I35b9405690e9f0607b24d79aa7c00830df954c41
2014-03-28 15:04:14 +00:00
Jenkins
cdf6f84c36 Merge "Python 3: Add six dependency" 2014-03-28 14:37:14 +00:00
Jenkins
b6ecec3cca Merge "Python 3: cast map() result to list" 2014-03-28 10:14:27 +00:00
Jenkins
14f0c89cc1 Merge "Python 3: Fix tests using temporary text files" 2014-03-28 10:14:26 +00:00
Jenkins
7dcefe1b64 Merge "Python 3: Replace iter.next() with six.next(iter)" 2014-03-28 09:59:03 +00:00
Victor Stinner
ac92c5cd7f Python 3: Add six dependency
Change-Id: I350eb089e02b4c33cf34c9fdb65289a2ad77f9c9
2014-03-28 09:25:11 +01:00
Victor Stinner
701faf0d16 Replace dict.iteritems() with dict.items()
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
2014-03-27 12:21:25 +01:00
Victor Stinner
46d62bd9be Python 3: Replace iter.next() with six.next(iter)
Use six.next() to be Python 3 compatible.

Change-Id: Ia16148a759d368872787d5896a7b1dc42ffcdfb5
2014-03-27 12:13:49 +01:00