diff options
| author | Daniel Wakefield <daniel.wakefield@hp.com> | 2015-03-04 14:01:55 +0000 |
|---|---|---|
| committer | Daniel Wakefield <daniel.wakefield@hp.com> | 2015-03-04 14:01:55 +0000 |
| commit | 13780f37c3f5e5f18f10f131d1ef39c010457e87 (patch) | |
| tree | 88fcf8f9b626a40bac3a74555a3afb7cbb39063a /tests/unit/test_swiftclient.py | |
| parent | 925c01ebfbdfb6478a3786f24a9572deae40f8f8 (diff) | |
| download | python-swiftclient-13780f37c3f5e5f18f10f131d1ef39c010457e87.tar.gz | |
Add improvements to MD5 validation.
With MD5Sum checking being added, a concern was brought up that It was
a change with no possibility of reverting to the old behaviour.
This change adds the flag '--ignore-checksum' to the upload subcommand
allowing the checks to be turned off.
Changed occurrences of the magic string for a null md5 to use a descriptive
constant instead.
Updated Error messages generated when validation fails. They should now be more descriptive
and not output a literal newline sequence.
Change-Id: Id1756cbb6700bb7e38f0ee0e75bc535e37f777ed
Diffstat (limited to 'tests/unit/test_swiftclient.py')
| -rw-r--r-- | tests/unit/test_swiftclient.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/unit/test_swiftclient.py b/tests/unit/test_swiftclient.py index 9ebcff5..d199050 100644 --- a/tests/unit/test_swiftclient.py +++ b/tests/unit/test_swiftclient.py @@ -32,6 +32,7 @@ from six.moves import reload_module from .utils import MockHttpTest, fake_get_auth_keystone, StubResponse +from swiftclient.utils import EMPTY_ETAG from swiftclient import client as c import swiftclient.utils import swiftclient @@ -102,8 +103,7 @@ class MockHttpResponse(object): self.requests_params = None self.verify = verify self.md5sum = md5() - # zero byte hash - self.headers = {'etag': '"d41d8cd98f00b204e9800998ecf8427e"'} + self.headers = {'etag': '"%s"' % EMPTY_ETAG} if headers: self.headers.update(headers) @@ -806,6 +806,7 @@ class TestPutObject(MockHttpTest): chunk_size=chunk_size) self.assertNotEquals(etag, contents.get_md5sum()) + self.assertEquals(etag, 'badresponseetag') self.assertEquals(raw_data_md5, contents.get_md5sum()) def test_md5_match(self): |
