776 Commits

Author SHA1 Message Date
Jenkins
5e13c3e845 Merge "Stop passing attr to keystoneclient when there's no filter_value" 2015-12-22 11:15:27 +00:00
Jenkins
3f1c304e3b Merge "Test 'string' behaviour of get_object" 2015-12-16 00:49:09 +00:00
Stuart McLaren
0103465fcb Test 'string' behaviour of get_object
Add a unit test to test the 'string' like behaviour of
get_object when it is called without resp_chunk_size set.

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: I496032a76036141d027c30b076c810b34bc6bef0
2015-12-15 17:15:27 +00:00
Jenkins
b558f0b143 Merge "Deprecated tox -downloadcache option removed" 2015-12-15 09:13:09 +00:00
Jenkins
6cdf470e18 Merge "Delete python bytecode before every test run" 2015-12-15 03:25:23 +00:00
shu-mutou
6bb97044c2 Delete python bytecode before every test run
Because python creates pyc|pyo files and __pycache__
directories during tox runs, certain changes in the tree,
like deletes of files, or switching branches, can create
spurious errors.

Change-Id: Ibaac514521bab11bbf552e0310d1203230c0d984
Closes-Bug: #1368661
2015-12-14 13:59:22 +09:00
Ondřej Nový
7c78c7bc2e Deprecated tox -downloadcache option removed
Caching is enabled by default from pip version 6.0

More info:
https://testrun.org/tox/latest/config.html#confval-downloadcache=path
https://pip.pypa.io/en/stable/reference/pip_install/#caching

Change-Id: I95015c79049633ed97714d6de8dd8f231bd15a03
2015-12-11 21:26:38 +01:00
Jenkins
4d9b1e760d Merge "Remove py26 support" 2015-12-10 20:29:16 +00:00
Jenkins
423ede01c4 Merge "New API documentation for python-swiftclient" 2015-12-10 20:28:52 +00:00
John Dickinson
bf07a69e0e fix release version
Change-Id: I0237adbcbd6249bab12ab1624b78b537511fc971
2.7.0
2015-12-07 14:55:30 -08:00
Tim Burke
2345ae54f1 Stop passing attr to keystoneclient when there's no filter_value
It was dropping warnings like "UserWarning: Providing attr without
filter_value to get_urls() is deprecated as of the 1.7.0 release and may
be removed in the 2.0.0 release. Either both should be provided or
neither should be provided."

Change-Id: Iead0bcf36b4a46bf465a55a33a21fd7f14f0ac40
2015-12-07 10:42:15 -08:00
John Dickinson
2d6e96d2f9 authors and changelog update for 2.6.1 release
Change-Id: Icefe2f62c2d2d41c5ee9764c51b0ae4ce1d9b3f3
2015-12-03 15:45:39 -08:00
ricolin
cffdc9d357 Remove py26 support
As of mitaka, the infra team won't have the resources available to
reasonably test py26, also the oslo team is dropping py26 support
from their libraries. sine we rely on oslo for a lot of our work,
and depend on infra for our CI, we should drop py26 support too.
Closes-Bug: 1519510
Depends-On: I37116731db11449d0c374a6a83a3a43789a19d5f

Change-Id: I776847ce77dfe82880f34d0b7804514e5aed3f8d
2015-12-02 15:09:44 +00:00
Jenkins
a564eb0e4c Merge "Unification of manpages and docstrings" 2015-12-01 13:03:05 +00:00
Jenkins
20731f4687 Merge "improve readme contents" 2015-12-01 02:13:17 +00:00
Jenkins
e675e1e938 Merge "Suppress iso8601 logging from --debug output" 2015-12-01 00:31:54 +00:00
Joel Wright
a3a78be87b New API documentation for python-swiftclient
New documentation for python-swiftclient that introduces
the APIs available and gives some opinionated advice about
when to use the shell, the client API and the service API.

Change-Id: I19020f041fab2e72469979f712ffe3951c431d24
2015-11-25 15:15:09 +00:00
Alistair Coles
562f386e93 Update mailmap
Change-Id: I0531928b531694008520298bea7d37b73216787e
2015-11-24 16:31:44 +00:00
Jenkins
2b42fefdbf Merge "Add py35 to default tox environments" 2015-11-23 18:46:45 +00:00
ricolin
7f304337a0 improve readme contents
Add more information in README.rst

Change-Id: I9fb9bea648fb1d1e26b0db4b590f72ffc85b7a33
2015-11-19 16:26:14 +08:00
Peter Lisák
3b1f4fda72 Unification of manpages and docstrings
* adding missing options
* unification of help

Change-Id: I2365e66433b63de8fd4da205611d9c1bf3bb6730
2015-11-13 17:32:12 +01:00
Jenkins
50978ddf63 Merge "Centralize header parsing" 2015-11-12 02:53:20 +00:00
Peter Lisák
3e1a457db0 Add content-type in list of container content
Change-Id: Ie0787d5ffbee0a7d2429cb285fa6ecdf722e4ae1
2015-11-11 12:21:40 +01:00
Jenkins
ad5656020c Merge "Add tests and param definitions for headers parameter" 2015-11-04 01:11:37 +00:00
Jenkins
1c649cc0d8 Merge "enable autodocumentation for utils module; docstring fixes" 2015-10-29 06:09:46 +00:00
Lisak, Peter
df1f4f3e39 swiftclient content-type header
According to help `swift upload -h` you can add a customized request header 'Content-Type'.
But actually it is ignored (cleared and default is used) if subcommand is upload.

Subcommand post works as expected in help.

Bug fix: Use 'Content-Type' from the customized request headers also if
uploading.

Change-Id: If0d1354b6214b909527341078fe1769aa6587457
2015-10-22 08:54:13 +00:00
Tim Burke
9fed7ed5e1 Miscellaneous (mostly test) cleanup
* Always use testtools.TestCase, since we're relying on testtools
 * Always use mock (as opposed to unittest.mock) since we're relying on
   mock
 * Add note about when a missing logging handler was added
 * Stop %-formatting the giant usage string that doesn't actually need
   any formatting
 * Prefer assertIs, assertIn, assertIsInstance over assertTrue
 * Use else-self.fail instead of sentinel values
 * Check resp.get('error') is None before checking resp['success'] is
   True, so test failures actually tell you something useful
 * Tighten some isinstance assertions
 * Import MockHttpTest from correct location
 * Only populate clean_os_environ once
 * Use setUp for setup, not __init__
 * Replace assertIn(key, dict) and assertEqual(foo, dict[key]) with
   assertEqual(foo, dict.get(key)) when key is a literal and foo is not
   None
 * Use mock.patch.object instead of manually patching for tests
 * Use six.binary_type instead of type(''.encode('utf-8'))
 * Stop shadowing builtin bytes
 * Reclaim some margin
 * Stop checking the return-type of encode_utf8; we already know it's
   bytes

Change-Id: I2138ea553378ce88810b7353147c8645a8f8c90e
2015-10-07 22:33:42 -07:00
Tim Burke
1b0567b6c7 Add py35 to default tox environments
Change-Id: Ib10eab87b791da561b82c9522ba2686d24966c2d
2015-10-01 12:31:12 -07:00
Alistair Coles
328d6a8d45 Add tests and param definitions for headers parameter
Cleanups for change I35c3b266b3c733f6b1629de4c683ea7d40128032

Add missing param definitions to client get_container
and head_object docstrings.

For consistency, add headers parameter to the Connection class
head_object and head_container wrapper methods.

Add tests to verify that the headers parameter of Connection
get_container, head_container and head_object methods is passed to the
module functions.

Change-Id: Ib40d5b626b2793840727c58cffbf725bea55651f
2015-09-23 12:21:45 +01:00
Alistair Coles
43b2c6bfe5 Make more assertions in client unit tests
Some tests rely on the fake connection checking expected request
parameters, but that assumes that the fake ocnnection is even called,
which is not being checked. Add more explicit assertions that requests
are in fact made.

Change-Id: Id1c48235d7d97fd1b0feec6c19ed59a87bebdf89
2015-09-23 09:55:10 +01:00
Tim Burke
305cd6253f Actually make assertions when testing get_account and get_container
Change-Id: Ibb1301b00d1bc99ec089ead02f944aa94972120a
2015-09-22 12:14:18 -07:00
Jenkins
c90547b5d4 Merge "Add headers parameter" 2015-09-22 11:43:28 +00:00
Monty Taylor
ccc3aa49ee Change ignore-errors to ignore_errors
Needed for coverage 4.0

Change-Id: I2789541f67d6adbdc8454183753832488fe2bbe2
2015-09-21 14:54:40 +00:00
Mahati
7cb99d3157 Add headers parameter
Headers parameter is required when passing client key for encryption.
It is missing for get_container and head_object.

Change-Id: I35c3b266b3c733f6b1629de4c683ea7d40128032
2015-09-16 21:55:56 +05:30
Qiu Yu
f65641c44d Suppress iso8601 logging from --debug output
This change silences logging from iso8601 when --debug option set

Change-Id: Ib8b8423012d43ef78d7138609fa98f40d46e7d4b
Closes-bug: #1324470
2015-09-12 03:10:15 +08:00
Zack M. Davis
6b3638ecec enable autodocumentation for utils module; docstring fixes
This commit adds the utils module to those for which Sphinx
automatically generates documentation from docstrings. (Many of the
functions here may be of little interest to users, but
`generate_temp_url`, at least, definitely deserves to be in the
documentation; in this way, this commit can be seen as a spiritual
companion to ca70dd9e.)

Also, a few markup errors and perceived infelicities in existing
docstrings are amended.

Change-Id: I8c66a23cb359d7dd9302a16459fad9825fedb690
2015-09-10 15:19:26 -07:00
Jenkins
26d29f5ce0 Merge "make ClientException.http_status default to None rather than 0" 2015-09-10 21:47:43 +00:00
Doug Hellmann
a2c84e0c93 Add links for release notes tool
The automated release note tool expects to find links to the bug
tracker, documentation, and source using a specific regex. This change
adds the links using the expected format so they are found and included
in the release announcements.

Change-Id: I5fa24f60c7d705593996194b865ffb2c47870808
2015-09-08 09:40:36 -07:00
Alistair Coles
1841bd6010 Initialise delete_object mock before it is called
Attempt to fix the linked bug by initialising the mock instance for
Connection.delete_object before calling the SwiftService upload
method, so that the delete_object mock already exists before the
delete_segments jobs that run in multiple threads call it.  Otherwise
there is a risk that the delete_segment job threads could race while
creating either the delete_object mock or the
delete_object.return_value mock, resulting in each thread getting a
different instance. That would explain the intermittent test failures
reported in the bug.

Change-Id: Ia82697c093529076b0bbcc6bccd577afdf0839e1
Partial-Bug: #1480223
2015-09-08 10:22:32 +01:00
John Dickinson
7cd2a01cda updated changelog for 2.6.0 release
Instead of a 2.5.1 release, add in the absolute tempurl option to the release and bump it to 2.6.0

Change-Id: Ie8335a737aac3211a240c25d88501f8f5dbccbea
2.6.0
2015-09-07 08:20:14 -07:00
Jenkins
fa7ffdd292 Merge "absolute expiry option for tempURL generation" 2015-09-05 20:16:38 +00:00
Charles Hsu
ee8c1bab98 Convert http response(byte string) to string in python3.
Avoid a TypeError exception in python3.

Change-Id: I4039e3f2a88b5f681288b5ca8dd5c63c13b7764f
Closes-bug: #1457012
2015-09-06 00:24:30 +08:00
Zack M. Davis
5ae4b42392 make ClientException.http_status default to None rather than 0
The extant default of zero is a bit counterintuitive;
insufficiently-careful programmers using swiftclient in their
application might, without carefully reading the source or
documentation, write buggy code based on the assumption that the
`http_status` attribute is absent or defaults to None if ClientException
is raised for reasons other than to indicate an unsuccessful HTTP
request. (However improbable this scenario may seem, the present author
can sadly attest to it having actually happened at least once.)

Just changing the default would break some tests on Python 3, due to the
`500 <= err.http_status <= 599` comparison in Connection's _retry
method (NoneType and int are not orderable in the Python 3.x series);
thus, the case where http_status is None is explicitly folded into a
code branch that logs and reraises (whereas previously it would have
fallen through to an `else` branch where it would be logged and reraised
just the same).

While we're here, we might as well make ClientException's __init__ use
super() (although admittedly the kinds of multiple-inheritance scenarios
in which `super` truly shines seem unlikely to occur here).

Change-Id: I8c02bfb4a0ef059e781be5e08fcde13fb1be5b88
2015-09-04 16:24:54 -07:00
Zack M. Davis
52d39bebc1 absolute expiry option for tempURL generation
The `tempurl` subcommand's second positional argument is called
`seconds` and has heretofore interpreted as the number of seconds for
which the tempURL should be valid, counting from the moment of running
the command. This is indeed a common, if not the most common,
use-case. But some users, occasionally, might want to generate a tempURL
that expires at some particular ("absolute") time, rather than a
particular amount of time relative to the moment of happening to run the
command. (One might make an analogy to the way in which Swift's expiring
object support supports an `X-Delete-At` header in addition to
`X-Delete-After`—and it's the former that must be regarded as
ontologically prior.) Thus, this commit adds an `--absolute` optional
argument to the `tempurl` subcommand; if present, the `seconds` argument
will be interpreted as a Unix timestamp of when the tempURL should be
expire, rather than a duration for which the tempURL should be valid
starting from "now".

Change-Id: If9ded96f2799800958d5063127f3de812f50ef06
2015-09-04 14:57:30 -07:00
John Dickinson
9ef4c97de2 do hand-curated authors/changelog files
Change-Id: I1a264c9ce1d137b18a6dc62623a282e4a2fe839c
2015-09-04 18:29:30 +01:00
Jenkins
93666bb84a Merge "Log and report trace on service operation fails" 2015-09-04 01:46:18 +00:00
Tim Burke
ce569f4651 Centralize header parsing
All response headers are now exposed as unicode objects. Any
url-encoding is interpretted as UTF-8; if that causes decoding to fail,
the url-encoded form is returned.

As a result, deleting DLOs with unicode characters will no longer raise
UnicodeEncodeErrors under Python 2.

Related-Bug: #1431866
Change-Id: Idb111c5bf3ac1f5ccfa724b3f4ede8f37d5bfac4
2015-09-03 13:46:03 -07:00
Jenkins
ff073ab34a Merge "Increase httplib._MAXHEADERS to 256." 2015-09-03 08:37:00 +00:00
Jenkins
996f672955 Merge "Cleanup and improve tests for download" 2015-09-03 07:43:56 +00:00
Jenkins
8cbbbeb7a8 Merge "Drop flake8 ignores for already-passing tests" 2015-09-03 02:19:09 +00:00