Hello community,
here is the log from the commit of package python-apache-libcloud for
openSUSE:Factory checked in at 2013-09-08 11:43:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-apache-libcloud (Old)
and /work/SRC/openSUSE:Factory/.python-apache-libcloud.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-apache-libcloud"
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-apache-libcloud/python-apache-libcloud.changes
2013-07-02 07:42:22.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.python-apache-libcloud.new/python-apache-libcloud.changes
2013-09-08 11:43:26.000000000 +0200
@@ -1,0 +2,16 @@
+Thu Sep 5 10:20:33 UTC 2013 - [email protected]
+
+- Updated to 0.13.1
+- General Changes:
+ - Fix a regression introduced in 0.13.0 and make sure to include
+ Content-Length 0 with PUT and POST requests.
+- Compute Changes:
+ - Fix a bug in the ElasticHosts driver and check for right HTTP status
+ code when determining drive imaging success.
+ - Update Opsource driver to include node public ip address (if available).
+- Storage Chagnes:
+ - Fix a regression with calling encode_container_name instead of
+ encode_object_name on object name in get_object method.
+ - Ensure that AWS S3 multipart upload works for small iterators.
+
+-------------------------------------------------------------------
Old:
----
apache-libcloud-0.13.0.tar.bz2
New:
----
apache-libcloud-0.13.1.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-apache-libcloud.spec ++++++
--- /var/tmp/diff_new_pack.G8O5LI/_old 2013-09-08 11:43:27.000000000 +0200
+++ /var/tmp/diff_new_pack.G8O5LI/_new 2013-09-08 11:43:27.000000000 +0200
@@ -16,7 +16,7 @@
#
Name: python-apache-libcloud
-Version: 0.13.0
+Version: 0.13.1
Release: 1
License: Apache-2.0
Summary: Abstract away differences among multiple cloud provider APIs
++++++ apache-libcloud-0.13.0.tar.bz2 -> apache-libcloud-0.13.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/apache-libcloud-0.13.0/CHANGES
new/apache-libcloud-0.13.1/CHANGES
--- old/apache-libcloud-0.13.0/CHANGES 2013-06-26 18:52:22.000000000 +0200
+++ new/apache-libcloud-0.13.1/CHANGES 2013-09-04 12:35:20.000000000 +0200
@@ -1,5 +1,34 @@
-*- coding: utf-8 -*-
+Changes with Apache Libcloud 0.13.1
+
+ *) General
+
+ - Fix a regression introduced in 0.13.0 and make sure to include
+ Content-Length 0 with PUT and POST requests. (LIBCLOUD-362, LIBCLOUD-390)
+ [Tomaz Muraus]
+
+ *) Compute
+
+ - Fix a bug in the ElasticHosts driver and check for right HTTP status
+ code when determining drive imaging success. (LIBCLOUD-363)
+ [Bob Thompson]
+
+ - Update Opsource driver to include node public ip address (if available).
+ (LIBCLOUD-384)
+ [Michael Bennett]
+
+ *) Storage
+
+ - Fix a regression with calling encode_container_name instead of
+ encode_object_name on object name in get_object method.
+ Reported by Ben Meng (LIBCLOUD-366)
+ [Tomaz Muraus]
+
+ - Ensure that AWS S3 multipart upload works for small iterators.
+ (LIBCLOUD-378)
+ [Mahendra M]
+
Changes with Apache Libcloud 0.13.0:
*) General
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/apache-libcloud-0.13.0/PKG-INFO
new/apache-libcloud-0.13.1/PKG-INFO
--- old/apache-libcloud-0.13.0/PKG-INFO 2013-06-26 19:14:24.000000000 +0200
+++ new/apache-libcloud-0.13.1/PKG-INFO 2013-09-04 12:56:25.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: apache-libcloud
-Version: 0.13.0
+Version: 0.13.1
Summary: A standard Python library that abstracts away differences among
multiple cloud provider APIs. For more information and documentation, please
see http://libcloud.apache.org
Home-page: http://libcloud.apache.org/
Author: Apache Software Foundation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/apache-libcloud-0.13.0/libcloud/__init__.py
new/apache-libcloud-0.13.1/libcloud/__init__.py
--- old/apache-libcloud-0.13.0/libcloud/__init__.py 2013-06-26
18:52:21.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/__init__.py 2013-09-04
12:35:35.000000000 +0200
@@ -20,7 +20,7 @@
"""
__all__ = ['__version__', 'enable_debug']
-__version__ = '0.13.0'
+__version__ = '0.13.1'
import os
import atexit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/apache-libcloud-0.13.0/libcloud/common/base.py
new/apache-libcloud-0.13.1/libcloud/common/base.py
--- old/apache-libcloud-0.13.0/libcloud/common/base.py 2013-06-26
19:09:10.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/common/base.py 2013-09-04
12:31:14.000000000 +0200
@@ -591,10 +591,14 @@
else:
headers.update({'Host': self.host})
- # Encode data if necessary
if data:
+ # Encode data if provided
data = self.encode_data(data)
headers.update({'Content-Length': str(len(data))})
+ else:
+ # Only send Content-Length 0 with POST and PUT request
+ if method.upper() in ['POST', 'PUT']:
+ headers.update({'Content-Length': '0'})
params, headers = self.pre_connect_hook(params, headers)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/apache-libcloud-0.13.0/libcloud/common/gogrid.py
new/apache-libcloud-0.13.1/libcloud/common/gogrid.py
--- old/apache-libcloud-0.13.0/libcloud/common/gogrid.py 2013-06-14
22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/common/gogrid.py 2013-09-04
12:31:05.000000000 +0200
@@ -82,6 +82,10 @@
m = hashlib.md5(b(key + secret + str(int(time.time()))))
return m.hexdigest()
+ def request(self, action, params=None, data='', headers=None,
method='GET', raw=False):
+ return super(GoGridConnection, self).request(action, params, data,
+ headers, method, raw)
+
class GoGridIpAddress(object):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/compute/drivers/elasticstack.py
new/apache-libcloud-0.13.1/libcloud/compute/drivers/elasticstack.py
--- old/apache-libcloud-0.13.0/libcloud/compute/drivers/elasticstack.py
2013-06-14 22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/compute/drivers/elasticstack.py
2013-09-04 12:31:14.000000000 +0200
@@ -276,7 +276,7 @@
method='POST'
)
- if response.status != 204:
+ if response.status not in (200, 204):
raise ElasticStackException('Drive imaging failed')
# We wait until the drive is imaged and then boot up the node
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/compute/drivers/gandi.py
new/apache-libcloud-0.13.1/libcloud/compute/drivers/gandi.py
--- old/apache-libcloud-0.13.0/libcloud/compute/drivers/gandi.py
2013-06-26 17:08:49.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/compute/drivers/gandi.py
2013-09-04 12:52:36.000000000 +0200
@@ -64,7 +64,7 @@
'disk': 50,
'bandwidth': 100,
},
- 'extra-large': {
+ 'x-large': {
'id': 'x-large',
'name': 'Extra Large instance',
'cpu': 4,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/compute/drivers/opsource.py
new/apache-libcloud-0.13.1/libcloud/compute/drivers/opsource.py
--- old/apache-libcloud-0.13.0/libcloud/compute/drivers/opsource.py
2013-06-14 22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/compute/drivers/opsource.py
2013-09-04 12:31:14.000000000 +0200
@@ -578,10 +578,12 @@
'status': status,
}
+ public_ip = findtext(element, 'publicIpAddress', SERVER_NS)
+
n = Node(id=findtext(element, 'id', SERVER_NS),
name=findtext(element, 'name', SERVER_NS),
state=state,
- public_ips=[],
+ public_ips=[public_ip] if public_ip is not None else [],
private_ips=findtext(element, 'privateIpAddress', SERVER_NS),
driver=self.connection.driver,
extra=extra)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/compute/drivers/vcloud.py
new/apache-libcloud-0.13.1/libcloud/compute/drivers/vcloud.py
--- old/apache-libcloud-0.13.0/libcloud/compute/drivers/vcloud.py
2013-06-26 17:08:49.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/compute/drivers/vcloud.py
2013-09-04 12:31:14.000000000 +0200
@@ -31,7 +31,6 @@
import time
from xml.etree import ElementTree as ET
-from xml.etree.ElementTree import _ElementInterface
from xml.parsers.expat import ExpatError
from libcloud.common.base import XmlResponse, ConnectionUserAndKey
@@ -588,8 +587,7 @@
except Exception:
# The vApp was probably removed since the previous vDC
query, ignore
e = sys.exc_info()[1]
- if not (isinstance(e.args[0], _ElementInterface) and
- e.args[0].tag.endswith('Error') and
+ if not (e.args[0].tag.endswith('Error') and
e.args[0].get('minorErrorCode') ==
'ACCESS_TO_RESOURCE_IS_FORBIDDEN'):
raise
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/storage/drivers/cloudfiles.py
new/apache-libcloud-0.13.1/libcloud/storage/drivers/cloudfiles.py
--- old/apache-libcloud-0.13.0/libcloud/storage/drivers/cloudfiles.py
2013-06-26 17:08:49.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/storage/drivers/cloudfiles.py
2013-09-04 12:31:14.000000000 +0200
@@ -260,7 +260,7 @@
def get_object(self, container_name, object_name):
container = self.get_container(container_name)
container_name_encoded = self._encode_container_name(container_name)
- object_name_encoded = self._encode_container_name(object_name)
+ object_name_encoded = self._encode_object_name(object_name)
response = self.connection.request('/%s/%s' % (container_name_encoded,
object_name_encoded),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/storage/drivers/local.py
new/apache-libcloud-0.13.1/libcloud/storage/drivers/local.py
--- old/apache-libcloud-0.13.0/libcloud/storage/drivers/local.py
2013-06-14 22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/storage/drivers/local.py
2013-09-04 12:31:05.000000000 +0200
@@ -32,6 +32,7 @@
from libcloud.utils.files import read_in_chunks
from libcloud.utils.py3 import relpath
+from libcloud.utils.py3 import u
from libcloud.common.base import Connection
from libcloud.storage.base import Object, Container, StorageDriver
from libcloud.common.types import LibcloudError
@@ -175,7 +176,7 @@
# use only the mtime attribute here. If the file contents change,
# the underlying file-system will change mtime
data_hash = self._get_hash_function()
- data_hash.update(str(stat.st_mtime))
+ data_hash.update(u(stat.st_mtime).encode('ascii'))
data_hash = data_hash.hexdigest()
extra = {}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/storage/drivers/s3.py
new/apache-libcloud-0.13.1/libcloud/storage/drivers/s3.py
--- old/apache-libcloud-0.13.0/libcloud/storage/drivers/s3.py 2013-06-14
22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/storage/drivers/s3.py 2013-09-04
12:31:14.000000000 +0200
@@ -491,7 +491,8 @@
params = {'uploadId': upload_id}
# Read the input data in chunk sizes suitable for AWS
- for data in read_in_chunks(iterator, chunk_size=CHUNK_SIZE):
+ for data in read_in_chunks(iterator, chunk_size=CHUNK_SIZE,
+ fill_size=True):
bytes_transferred += len(data)
if calculate_hash:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
new/apache-libcloud-0.13.1/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
---
old/apache-libcloud-0.13.0/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
2013-06-14 22:18:58.000000000 +0200
+++
new/apache-libcloud-0.13.1/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
2013-09-04 12:31:05.000000000 +0200
@@ -17,6 +17,7 @@
<sourceImageId>44ed8b72-ebea-11df-bdc1-001517c46384</sourceImageId>
<networkId>53b4c05b-341e-4ac3-b688-bdd78e43ca9e</networkId>
<privateIpAddress>10.162.1.1</privateIpAddress>
+ <publicIpAddress>200.16.132.7</publicIpAddress>
<machineName>10-162-1-1</machineName>
<isStarted>true</isStarted>
<deployedTime>2011-03-02T17:16:09.882Z</deployedTime>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/compute/test_ec2.py
new/apache-libcloud-0.13.1/libcloud/test/compute/test_ec2.py
--- old/apache-libcloud-0.13.0/libcloud/test/compute/test_ec2.py
2013-06-26 17:08:49.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/test/compute/test_ec2.py
2013-09-04 12:31:14.000000000 +0200
@@ -438,6 +438,8 @@
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _create_ex_blockdevicemappings_RunInstances(self, method, url, body,
headers):
+ # Need to remove '/?'
+ url = url[2:]
parameters = dict(parse_qsl(url))
self.assertEqual(parameters['BlockDeviceMapping.1.DeviceName'],
'/dev/sdb')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/compute/test_elasticstack.py
new/apache-libcloud-0.13.1/libcloud/test/compute/test_elasticstack.py
--- old/apache-libcloud-0.13.0/libcloud/test/compute/test_elasticstack.py
2013-06-14 22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/test/compute/test_elasticstack.py
2013-09-04 12:31:14.000000000 +0200
@@ -215,7 +215,7 @@
def
_drives_0012e24a_6eae_4279_9912_3432f698cec8_image_38df0986_4d85_4b76_b502_3878ffc80161_gunzip(self,
method, url, body, headers):
# ElasticHosts image
- return (httplib.NO_CONTENT, body, {},
httplib.responses[httplib.NO_CONTENT])
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def
_drives_0012e24a_6eae_4279_9912_3432f698cec8_image_90aa51f2_15c0_4cff_81ee_e93aa20b9468_gunzip(self,
method, url, body, headers):
# Skalikloud image
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/compute/test_opsource.py
new/apache-libcloud-0.13.1/libcloud/test/compute/test_opsource.py
--- old/apache-libcloud-0.13.0/libcloud/test/compute/test_opsource.py
2013-06-14 22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/test/compute/test_opsource.py
2013-09-04 12:31:14.000000000 +0200
@@ -144,6 +144,15 @@
self.assertEqual(nets[0].name, 'test-net1')
self.assertTrue(isinstance(nets[0].location, NodeLocation))
+ def test_node_public_ip(self):
+ nodes = self.driver.list_nodes()
+ for node in nodes:
+ if node.id == "abadbc7e-9e10-46ca-9d4a-194bcc6b6c16":
+ self.assertEqual(node.public_ips[0], '200.16.132.7')
+ else:
+ self.assertEqual(len(node.public_ips), 0)
+
+
class OpsourceMockHttp(MockHttp):
fixtures = ComputeFileFixtures('opsource')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/compute/test_vcloud.py
new/apache-libcloud-0.13.1/libcloud/test/compute/test_vcloud.py
--- old/apache-libcloud-0.13.0/libcloud/test/compute/test_vcloud.py
2013-06-26 17:08:49.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/test/compute/test_vcloud.py
2013-09-04 12:31:14.000000000 +0200
@@ -412,7 +412,7 @@
self.tag = 'Error'
def get(self, foo):
- return 'ACCESS_TO_RESOURCE_IS_FORBIDDEN'
+ return 'ACCESS_TO_RESOURCE_IS_FORBIDDEN_1'
class AnotherError(Exception):
pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/storage/test_cloudfiles.py
new/apache-libcloud-0.13.1/libcloud/test/storage/test_cloudfiles.py
--- old/apache-libcloud-0.13.0/libcloud/test/storage/test_cloudfiles.py
2013-06-26 17:08:49.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/test/storage/test_cloudfiles.py
2013-09-04 12:31:14.000000000 +0200
@@ -201,6 +201,11 @@
self.assertEqual(obj.meta_data['foo-bar'], 'test 1')
self.assertEqual(obj.meta_data['bar-foo'], 'test 2')
+ def test_get_object_object_name_encoding(self):
+ obj = self.driver.get_object(container_name='test_container',
+ object_name='~/test_object/')
+ self.assertEqual(obj.name, '~/test_object/')
+
def test_get_object_not_found(self):
try:
self.driver.get_object(container_name='test_container',
@@ -839,6 +844,22 @@
'content-type': 'application/zip'})
return (status_code, body, headers, httplib.responses[httplib.OK])
+ def _v1_MossoCloudFS_test_container__7E_test_object(
+ self, method, url, body, headers):
+ headers = copy.deepcopy(self.base_headers)
+ if method == 'HEAD':
+ # get_object_name_encoding
+ body = self.fixtures.load('list_container_objects_empty.json')
+ status_code = httplib.NO_CONTENT
+ headers.update({ 'content-length': 555,
+ 'last-modified': 'Tue, 25 Jan 2011 22:01:49 GMT',
+ 'etag': '6b21c4a111ac178feacf9ec9d0c71f17',
+ 'x-object-meta-foo-bar': 'test 1',
+ 'x-object-meta-bar-foo': 'test 2',
+ 'content-type': 'application/zip'})
+ return (status_code, body, headers, httplib.responses[httplib.OK])
+
+
def _v1_MossoCloudFS_test_create_container(
self, method, url, body, headers):
# test_create_container_success
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/storage/test_local.py
new/apache-libcloud-0.13.1/libcloud/test/storage/test_local.py
--- old/apache-libcloud-0.13.0/libcloud/test/storage/test_local.py
2013-06-14 22:18:58.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/test/storage/test_local.py
2013-09-04 12:31:05.000000000 +0200
@@ -310,7 +310,7 @@
data = ''
for buff in stream:
- data += buff
+ data += buff.decode('utf-8')
self.assertTrue(len(data), 4096)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/storage/test_s3.py
new/apache-libcloud-0.13.1/libcloud/test/storage/test_s3.py
--- old/apache-libcloud-0.13.0/libcloud/test/storage/test_s3.py 2013-06-25
09:12:33.000000000 +0200
+++ new/apache-libcloud-0.13.1/libcloud/test/storage/test_s3.py 2013-09-04
12:31:14.000000000 +0200
@@ -34,6 +34,7 @@
from libcloud.storage.drivers.s3 import S3EUWestStorageDriver
from libcloud.storage.drivers.s3 import S3APSEStorageDriver
from libcloud.storage.drivers.s3 import S3APNEStorageDriver
+from libcloud.storage.drivers.s3 import CHUNK_SIZE
from libcloud.storage.drivers.dummy import DummyIterator
from libcloud.test import StorageMockHttp, MockRawResponse # pylint:
disable-msg=E0611
@@ -243,8 +244,6 @@
self.assertEqual(part_no, str(count))
self.assertEqual(etag, headers['etag'])
- self.assertEqual(count, 3)
-
body = self.fixtures.load('complete_multipart.xml')
return (httplib.OK,
body,
@@ -740,7 +739,7 @@
self.assertTrue('some-value' in obj.meta_data)
self.driver_type._upload_file = old_func
- def test_upload_object_via_stream(self):
+ def test_upload_small_object_via_stream(self):
if self.driver.supports_s3_multipart_upload:
self.mock_raw_response_klass.type = 'MULTIPART'
@@ -762,6 +761,28 @@
self.assertEqual(obj.name, object_name)
self.assertEqual(obj.size, 3)
+ def test_upload_big_object_via_stream(self):
+
+ if self.driver.supports_s3_multipart_upload:
+ self.mock_raw_response_klass.type = 'MULTIPART'
+ self.mock_response_klass.type = 'MULTIPART'
+ else:
+ self.mock_raw_response_klass.type = None
+ self.mock_response_klass.type = None
+
+ container = Container(name='foo_bar_container', extra={},
+ driver=self.driver)
+ object_name = 'foo_test_stream_data'
+ iterator = DummyIterator(data=['2'*CHUNK_SIZE, '3'*CHUNK_SIZE, '5'])
+ extra = {'content_type': 'text/plain'}
+ obj = self.driver.upload_object_via_stream(container=container,
+ object_name=object_name,
+ iterator=iterator,
+ extra=extra)
+
+ self.assertEqual(obj.name, object_name)
+ self.assertEqual(obj.size, CHUNK_SIZE*2 + 1)
+
def test_upload_object_via_stream_abort(self):
if not self.driver.supports_s3_multipart_upload:
return
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/apache-libcloud-0.13.0/libcloud/test/test_connection.py
new/apache-libcloud-0.13.1/libcloud/test/test_connection.py
--- old/apache-libcloud-0.13.0/libcloud/test/test_connection.py 1970-01-01
01:00:00.000000000 +0100
+++ new/apache-libcloud-0.13.1/libcloud/test/test_connection.py 2013-09-04
12:31:05.000000000 +0200
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+# Licensed to the Apache Software Foundation (ASF) under one or more§
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import unittest
+
+from mock import Mock
+
+from libcloud.common.base import Connection
+
+
+class ConnectionClassTestCase(unittest.TestCase):
+ def setUp(self):
+ self.originalConnect = Connection.connect
+ self.originalResponseCls = Connection.responseCls
+
+ Connection.connect = Mock()
+ Connection.responseCls = Mock()
+
+ def tearDown(self):
+ Connection.connect = self.originalConnect
+ Connection.responseCls = Connection.responseCls
+
+ def test_content_length(self):
+ con = Connection()
+ con.connection = Mock()
+
+ ## GET method
+ # No data, no content length should be present
+ con.request('/test', method='GET', data=None)
+ call_kwargs = con.connection.request.call_args[1]
+ self.assertTrue('Content-Length' not in call_kwargs['headers'])
+
+ # '' as data, no content length should be present
+ con.request('/test', method='GET', data='')
+ call_kwargs = con.connection.request.call_args[1]
+ self.assertTrue('Content-Length' not in call_kwargs['headers'])
+
+ # 'a' as data, content length should be present (data in GET is not
+ # corect, but anyways)
+ con.request('/test', method='GET', data='a')
+ call_kwargs = con.connection.request.call_args[1]
+ self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
+
+ ## POST, PUT method
+ # No data, content length should be present
+ for method in ['POST', 'PUT', 'post', 'put']:
+ con.request('/test', method=method, data=None)
+ call_kwargs = con.connection.request.call_args[1]
+ self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
+
+ # '' as data, content length should be present
+ for method in ['POST', 'PUT', 'post', 'put']:
+ con.request('/test', method=method, data='')
+ call_kwargs = con.connection.request.call_args[1]
+ self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
+
+ # 'a' as data, content length should be present
+ for method in ['POST', 'PUT', 'post', 'put']:
+ con.request('/test', method=method, data='a')
+ call_kwargs = con.connection.request.call_args[1]
+ self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
+
+
+if __name__ == '__main__':
+ sys.exit(unittest.main())
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]