diff options
author | James Saryerwinnie <js@jamesls.com> | 2013-02-21 18:55:55 -0800 |
---|---|---|
committer | James Saryerwinnie <js@jamesls.com> | 2013-02-21 18:55:55 -0800 |
commit | 9a98f31373d94363699ad6e073b3b0055daab951 (patch) | |
tree | a5f54897206f3066128ea487c42d62e594c93808 | |
parent | 72cf39aa6e4fc68bbcfc6054354b14b3188c3655 (diff) | |
parent | 39b6a91f4d2536a723188e54c1c222d20e780cb6 (diff) | |
download | boto-9a98f31373d94363699ad6e073b3b0055daab951.tar.gz |
Merge branch 'ohe-develop' into develop
* ohe-develop:
Add unittest for #1339
[refs boto/boto#1302] - adds a return value to set_contents_from_filename
-rw-r--r-- | boto/s3/key.py | 10 | ||||
-rw-r--r-- | tests/integration/s3/test_connection.py | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/boto/s3/key.py b/boto/s3/key.py index d4a1a5f5..09437ea7 100644 --- a/boto/s3/key.py +++ b/boto/s3/key.py @@ -1194,12 +1194,16 @@ class Key(object): :param encrypt_key: If True, the new copy of the object will be encrypted on the server-side by S3 and will be stored in an encrypted form while at rest in S3. + + :rtype: int + :return: The number of bytes written to the key. """ fp = open(filename, 'rb') try: - self.set_contents_from_file(fp, headers, replace, cb, num_cb, - policy, md5, reduced_redundancy, - encrypt_key=encrypt_key) + return self.set_contents_from_file(fp, headers, replace, + cb, num_cb, policy, + md5, reduced_redundancy, + encrypt_key=encrypt_key) finally: fp.close() diff --git a/tests/integration/s3/test_connection.py b/tests/integration/s3/test_connection.py index b6733036..5d7473ee 100644 --- a/tests/integration/s3/test_connection.py +++ b/tests/integration/s3/test_connection.py @@ -99,7 +99,8 @@ class S3ConnectionTest (unittest.TestCase): k.name = 'foo/bar' k.set_contents_from_string(s1, headers) k.name = 'foo/bas' - k.set_contents_from_filename('foobar') + size = k.set_contents_from_filename('foobar') + assert size == 42 k.name = 'foo/bat' k.set_contents_from_string(s1) k.name = 'fie/bar' |