summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | Accept gzip-encoded API responsesTim Burke2016-08-302-3/+55
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we would accept gzip-encoded responses, but only because we were letting requests decode *all* responses (even object data). This restores the previous capability, but with tighter controls about which requests will accept gzipped responses and where the decoding happens. Change-Id: I4fd8b97207b9ab01b1bcf825cc16efd8ad46344a Related-Bug: 1282861 Related-Bug: 1338464
* | | | Merge "Convert numeric and boolean header values to strings"Jenkins2016-08-312-4/+14
|\ \ \ \ | |/ / / |/| | |
| * | | Convert numeric and boolean header values to stringsTim Burke2016-08-252-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently, requests got a bit more picky about what types of data it will accept as header values [1]. The reasons for this are generally sound; str()ing arbitrary objects just before pushing them out a socket may not do what the developer wanted/expected. However, there are a few standard types that developers may be sending that we should convert for them as a convenience. Now, we'll convert all int, float, and bool values to strings before sending them on to requests. Change-Id: I6c2f451009cb03cb78812f54e4ed8566076de821 Closes-Bug: 1614932
* | | | Merge "client: renew token on 401 even if retries is 0"Jenkins2016-08-261-0/+78
|\ \ \ \
| * | | | client: renew token on 401 even if retries is 0Julien Danjou2016-06-071-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gnocchi uses a client with retries=0 to maximize throughtput and not retry N times on e.g. 404 when checking existence of an object. However, this as the side effect of never renewing the token since there' no retry on 401 either. This patches change the behavior so that 401 errors are always retried, whatever the retries value is. Closes-Bug: #1589926 Change-Id: Ie06adf4cf17ea4592b5bbd7bbde9828e5e134e3e
* | | | | Use mock patch to handle get_auth_keystoneJamie Lennox2016-08-251-133/+144
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting c.get_auth_keystone = fake_get_auth_keystone is setting a new method on the module. This information is not reset between test runs and therefore has the potential to corrupt other tests. Use mock patch so that the mock is reset after the test is complete. Change-Id: Ifb9ba72634cf477c72dda080b5aed8f8e3a7ac89
* | | | Merge "Strip leading/trailing whitespace from headers"Jenkins2016-08-251-1/+1
|\ \ \ \ | |_|_|/ |/| | |
| * | | Strip leading/trailing whitespace from headersTim Burke2016-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New versions of requests will raise an InvalidHeader error otherwise. Change-Id: Idf3bcd8ac359bdda9a847bf99a78988943374134 Closes-Bug: #1614280 Closes-Bug: #1613814
* | | | Merge "Add copy object method"Jenkins2016-08-244-0/+383
|\ \ \ \ | |/ / / |/| | |
| * | | Add copy object methodMarek Kaleta2016-08-234-0/+383
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement copy object method in swiftclient Connection, Service and CLI. Although COPY functionality can be accomplished with 'X-Copy-From' header in PUT request, using copy is more convenient especially when using copy for updating object metadata non-destructively. Closes-Bug: 1474939 Change-Id: I1338ac411f418f4adb3d06753d044a484a7f32a4
* | | Merge "Fix unicode issues in tempurl command"Jenkins2016-08-071-33/+109
|\ \ \
| * | | Fix unicode issues in tempurl commandTim Burke2016-07-191-33/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we weren't encoding paths and keys as UTF-8, which would trigger a UnicodeEncodeError on py27. Change-Id: I2fad428369406c2ae32343a5e943ffb2cd1ca6ef
* | | | Merge "Add --json option to `swift capabilities` / `swift info`"Jenkins2016-08-061-0/+16
|\ \ \ \
| * | | | Add --json option to `swift capabilities` / `swift info`Tim Burke2016-08-021-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets us do things like: $ swift info --json | jq '[.swift.policies[].name]' [ "Standard-Replica", "EC" ] Also, escape more dashes in the man page, so they won't be misinterpreted as hyphens. Change-Id: Ic7690bdbcfc55f55e5dde9bc11bb0644085973ce
* | | | | Modify assertzheng yin2016-07-261-25/+25
|/ / / / | | | | | | | | | | | | | | | | | | | | For example: self.assertEqual(a,None) is equal to self.assertIsNone(a) Change-Id: I063145d034979cf3d36645a00a30cc27defac7c4
* | | | Add __ne__ built-in functionyuyafei2016-07-051-0/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Python 3 __ne__ by default delegates to __eq__ and inverts the result, but in Python 2 they urge you to define __ne__ when you define __eq__ for it to work properly [1].There are no implied relationships among the comparison operators. The truth of x==y does not imply that x!=y is false. Accordingly, when defining __eq__(), one should also define __ne__() so that the operators will behave as expected. [1]https://docs.python.org/2/reference/datamodel.html#object.__ne__ Change-Id: I5485022f010cdcb88c0d4ebe5c44a39a1bf242b0
* | | Merge "Query string functionality for containers"Jenkins2016-06-141-0/+31
|\ \ \ | |_|/ |/| |
| * | Query string functionality for containersAndrew Welleck2016-06-091-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added functionality for arbitrary query strings to be passed into container functions. Additionally a minor typo correction in the README. Added unit tests for query string functionality. Closes-Bug: #1542459 Change-Id: Ica2cb3ea439632588388e748d8d2e944e9ed4fa4
* | | Merge "Add an option: disable etag check on downloads"Jenkins2016-06-062-0/+27
|\ \ \
| * | | Add an option: disable etag check on downloadsCheng Li2016-06-022-0/+27
| | |/ | |/| | | | | | | | | | | | | | | | | | | This patch is to add an option of disable etag check on downloads. Change-Id: I9ad389dd691942dea6db470ca3f0543eb6e9703e Closes-bug: #1581147
* | | Suppress InsecureRequestWarning when using --insecureTim Burke2016-06-011-10/+18
|/ / | | | | | | | | | | | | | | | | The user already knows this is insecure, there's no point in bringing it up again and again. See also: https://github.com/kennethreitz/requests/issues/2214 Change-Id: I7991b2e568407269f84138bc03711147ed080c9c
* | Merge "Support client certificate/key"Jenkins2016-05-193-3/+46
|\ \
| * | Support client certificate/keyCedric Brandily2016-04-103-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change enables to specify a client certificate/key with: * usual CLI options (--os-cert/--os-key) * usual environment variables ($OS_CERT/$OS_KEY) Closes-Bug: #1565112 Change-Id: I12e151adcb6084d801c6dfed21d82232a3259aea
* | | Merge "Use application/directory content-type for dir markers"Jenkins2016-05-191-0/+136
|\ \ \ | |_|/ |/| |
| * | Use application/directory content-type for dir markersTim Burke2016-04-081-0/+136
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we were using a content-type of text/directory, but that is already defined in RFC 2425 and doesn't reflect our usage: The text/directory Content-Type is defined for holding a variety of directory information, for example, name, or email address, or logo. (From there it goes on to describe a superset of the vCard format defined in RFC 2426.) application/directory, on the other hand, is used by Static Web [1] and is used by cloudfuse [2]. Seems like as sane a choice as any to standardize on. [1] https://github.com/openstack/swift/blob/2.5.0/swift/common/middleware/staticweb.py#L71-L75 [2] https://github.com/redbo/cloudfuse/blob/1.0/README#L105-L106 Change-Id: I19e30484270886292d83f50e7ee997b6e1623ec7
* | Merge "Check responses when retrying bodies"Jenkins2016-05-111-2/+68
|\ \
| * | Check responses when retrying bodiesTim Burke2016-05-041-2/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a Range request came back 200 OK (rather than 206 Partial Content), we would mangle the response body. This could happen if there was a middleware that would silently drop Range headers, for example. Now, if the response does not include a Content-Range header, we will log a warning and seek to our previous position in the stream. If the Content-Range header has an unexpected value, we will raise an exception. Change-Id: I94d4536cc1489968d45a2b6ba7edd70c85800275
* | | Merge "Tighten up testing for sloppy auth version"Jenkins2016-05-081-4/+10
|\ \ \
| * | | Tighten up testing for sloppy auth versionAlistair Coles2016-05-051-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing test that os-identity-api-version=2 would result in the correct auth_version=2.0 (note 2 -> 2.0) does not verify the sloppy version handling code path. When auth, key and user options are all missing the auth version is always set to 2.0 so the test will always pass. Adding auth, key and user options to the test command will cause the test to verify that the os-identity-api-version option was used and mapped to 2.0. Change-Id: Ifa10cd2b8bf81c082d5e3fa846f993871194fea0
* | | | Default to v3 auth if we find a (user|project)-domain-(name|id) optionTim Burke2016-05-031-0/+29
|/ / / | | | | | | | | | Change-Id: I4616492752b620de0bf90672142f1071ec9bac83
* | | Pull option processing out to service.pyTim Burke2016-05-031-0/+37
| | | | | | | | | | | | | | | | | | | | | ...because it seems silly that we do nearly the same thing in two different places Change-Id: Iafafe3c553d00652adb91ceefd0de1479cbcb5da
* | | Parse options to dictTim Burke2016-05-031-6/+6
| | | | | | | | | | | | | | | | | | | | | This is a first step toward unifying the options parsing magic between shell.py and service.py Change-Id: If001e07978c0bae729ac0cd9b2c2934092c98447
* | | Merge "Add tests for thread option validation"Jenkins2016-05-021-0/+95
|\ \ \
| * | | Add tests for thread option validationTim Burke2016-03-171-0/+95
| | | | | | | | | | | | | | | | Change-Id: If84714c7ea6be1c95c5898a82db2d4b6c9637242
* | | | Merge "Identify segments uploaded via swiftclient"Jenkins2016-05-021-15/+18
|\ \ \ \
| * | | | Identify segments uploaded via swiftclientTim Burke2016-04-081-15/+18
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...using a new "application/swiftclient-segment" content-type. Segments uploaded by swiftclient are expected to have a many-to-one relationship to large objects, rather than the more-general many-to-many relationship that SLO and DLO generally allow. Later, we may use this information to make more intelligent decisions, such as when to automatically clean up segments. Change-Id: Ie56a3aa10065db754ac572cc37d93f2c901aac60
* | | | Merge "Fix downloading from "marker" item"Jenkins2016-04-141-0/+35
|\ \ \ \ | |/ / / |/| | |
| * | | Fix downloading from "marker" itemSergey Gotliv2016-04-081-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation of "swift download" hints that "marker" option is supported, but in reality we forgot to patch it through, so all downloads were always done with the default, empty marker. Closes-Bug: #1565393 Change-Id: I38bd29d2baa9188b61397dec75ce1d864041653c
* | | | Merge "Port from optparse to argparse"Jenkins2016-04-081-15/+18
|\ \ \ \ | |/ / / |/| | |
| * | | Port from optparse to argparseTim Burke2016-04-061-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why now? * argparse was introduced in Python 3.2 and back-ported to Python 2.7. Until we dropped Python 2.6 support, we were stuck on optparse. * keystoneauth.loading.cli provides register_argparse_arguments and load_from_argparse_arguments helper methods. Now that we're moving toward Keystone Session support, argparse seems required. Closes-Bug: 1553030 Change-Id: I5139fb64a8631a3010680090fd04345f95c55c7b
* | | | Clean up some unnecessary variablesTim Burke2016-03-241-28/+22
| | | | | | | | | | | | | | | | Change-Id: Iac93ced6344d4a6fee7e6390e891fde765814c03
* | | | Fix SwiftPostObject options usage in SwiftServiceMarek Kaleta2016-03-231-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SwiftService().post(cont, [SwiftPostObject(obj, options]) currently ignores options['header'], raises exception when options['headers'] is set and make malformed metadata when options['meta'] is set. Fix tipos in code, add unittest for SwiftService().post Closes-Bug: #1560052 Change-Id: Ie460f753492e9b73836b4adfc7c9c0f2130a8a91
* | | | Merge "Initialize delete_object mock *before* creating all the threads"Jenkins2016-03-181-0/+1
|\ \ \ \
| * | | | Initialize delete_object mock *before* creating all the threadsTim Burke2016-03-171-0/+1
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we'd occasionally get spurious failures like FAIL: test_delete_account (tests.unit.test_shell.TestShell) ---------------------------------------------------------------------- Traceback (most recent call last): File ".../mock/mock.py", line 1721, in _inner return f(*args, **kw) File ".../mock/mock.py", line 1305, in patched return func(*args, **keywargs) File ".../tests/unit/test_shell.py", line 788, in test_delete_account response_dict={})], any_order=True) File ".../mock/mock.py", line 983, in assert_has_calls ), cause) File ".../six.py", line 718, in raise_from raise value AssertionError: (call(u'container', u'object', query_string=None, response_dict={}),) not all found in call list Related-Bug: #1539536 Related-Bug: #1480223 Change-Id: I810894545ca74d3b2f2dbde2d0388eb69c2ba710
* | | | Merge "Include response headers in ClientExceptions"Jenkins2016-03-173-26/+116
|\ \ \ \ | |/ / / |/| | |
| * | | Include response headers in ClientExceptionsTim Burke2016-03-033-26/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, client applications can get to things like transaction IDs for failures without needing to turn on all of logging. While we're at it, add a from_response factory method for ClientException. Co-Authored-By: Alexander Corwin <ancorwin@gmail.com> Change-Id: Ib46d5f8fc7f36f651f5908bb9d900316fdaebce3
* | | | Initialise delete_object mock before it's calledMin Min Ren2016-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the linked bug. delete_object mock should be before it's called by swiftclient.shell.main function. Related: https://review.openstack.org/221219 Change-Id: I52143a93c129764c02bba05267f3563c824e82cb Partial-Bug: #1480223
* | | | Merge "download method shouldn't download all object"Jenkins2016-03-021-0/+16
|\ \ \ \ | |/ / / |/| | |
| * | | download method shouldn't download all objectHu Bing2016-03-011-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in python-swiftclient/swiftclient/service.py, there is a method def download(self, container=None, objects=None, options=None): if container is specified but objects not, it download all objects in specified container. if both container and objects are specified, it download all specified objects in the container. when it comes to the case that, objects argument is specified, but it turned out to be empty array [ ], the download method download all the objects under specified container. this may be not reasonable. for example, the objects was not empty when it came from command line, but it's filtered, maybe by --prefix argument. at last, it turned out to be empty array. when calling download method with objects arguments being empty array, we should download nothing instead of all the objects under the specified container. Change-Id: I81aab935533a50b40679c8b3575f298c285233a8 Closes-bug: #1549881
* | | | Merge "Drop testtools from test-requirements.txt"Jenkins2016-03-018-121/+114
|\ \ \ \