Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: tests/s3/test_gsconnection.py

Issue 8386013: Merging in latest boto. (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Redoing vendor drop by deleting and then merging. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/s3/test_encryption.py ('k') | tests/s3/test_https_cert_validation.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/s3/test_gsconnection.py
diff --git a/boto/tests/test_gsconnection.py b/tests/s3/test_gsconnection.py
similarity index 79%
rename from boto/tests/test_gsconnection.py
rename to tests/s3/test_gsconnection.py
index 5c324fa166840ce4eca0ed5b43279ad0ebf08bbc..e38f442165eee500053db1ec1bf3233b1e374bd4 100644
--- a/boto/tests/test_gsconnection.py
+++ b/tests/s3/test_gsconnection.py
@@ -1,7 +1,7 @@
-#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
+# Copyright (c) 2006-2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
+# Copyright (c) 2011, Nexenta Systems, Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,7 +18,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -76,6 +76,20 @@ class GSConnectionTest (unittest.TestCase):
md5 = k.md5
k.set_contents_from_string(s2)
assert k.md5 != md5
+ # Test for stream API
+ fp2 = open('foobar', 'rb')
+ k.md5 = None
+ k.base64md5 = None
+ k.set_contents_from_stream(fp2, headers=headers)
+ fp = open('foobar1', 'wb')
+ k.get_contents_to_file(fp)
+ fp.close()
+ fp2.seek(0,0)
+ fp = open('foobar1', 'rb')
+ assert (fp2.read() == fp.read()), 'Chunked Transfer corrupted the Data'
+ fp.close()
+ fp2.close()
+ os.unlink('foobar1')
os.unlink('foobar')
all = bucket.get_all_keys()
assert len(all) == 6
@@ -101,12 +115,12 @@ class GSConnectionTest (unittest.TestCase):
mdval2 = 'This is the second metadata value'
k.set_metadata(mdkey2, mdval2)
# try a unicode metadata value
-
+
mdval3 = u'föö'
mdkey3 = 'meta3'
k.set_metadata(mdkey3, mdval3)
k.set_contents_from_string(s1)
-
+
k = bucket.lookup('has_metadata')
assert k.get_metadata(mdkey1) == mdval1
assert k.get_metadata(mdkey2) == mdval2
@@ -140,6 +154,22 @@ class GSConnectionTest (unittest.TestCase):
k.set_acl('private')
acl = k.get_acl()
assert len(acl.entries.entry_list) == 1
+ # try set/get raw logging subresource
+ empty_logging_str="<?xml version='1.0' encoding='UTF-8'?><Logging/>"
+ logging_str = (
+ "<?xml version='1.0' encoding='UTF-8'?><Logging>"
+ "<LogBucket>log-bucket</LogBucket>" +
+ "<LogObjectPrefix>example</LogObjectPrefix>" +
+ "<PredefinedAcl>bucket-owner-full-control</PredefinedAcl>" +
+ "</Logging>")
+ bucket.set_subresource('logging', logging_str);
+ assert bucket.get_subresource('logging') == logging_str;
+ # try disable/enable logging
+ bucket.disable_logging()
+ assert bucket.get_subresource('logging') == empty_logging_str
+ bucket.enable_logging('log-bucket', 'example',
+ canned_acl='bucket-owner-full-control')
+ assert bucket.get_subresource('logging') == logging_str;
# now delete all keys in bucket
for k in bucket:
bucket.delete_key(k)
« no previous file with comments | « tests/s3/test_encryption.py ('k') | tests/s3/test_https_cert_validation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698