libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [06/14] git commit: Update affected test and mockhttp class.
Date Sat, 15 Jun 2013 06:28:16 GMT
Update affected test and mockhttp class.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cb18a091
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cb18a091
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cb18a091

Branch: refs/heads/trunk
Commit: cb18a091c05e38975e5faf565af09549cb5b7aea
Parents: 5e782bf
Author: Tomaz Muraus <tomaz@tomaz.me>
Authored: Fri Jun 14 23:05:47 2013 -0700
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Fri Jun 14 23:05:47 2013 -0700

----------------------------------------------------------------------
 libcloud/test/__init__.py               | 4 ++--
 libcloud/test/compute/test_brightbox.py | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cb18a091/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index c6c8dff..20c8a75 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -77,9 +77,9 @@ class MockResponse(object):
     reason = ''
     version = 11
 
-    def __init__(self, status, body, headers=None, reason=None):
+    def __init__(self, status, body=None, headers=None, reason=None):
         self.status = status
-        self.body = StringIO(u(body))
+        self.body = StringIO(u(body)) if body else StringIO()
         self.headers = headers or self.headers
         self.reason = reason or self.reason
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cb18a091/libcloud/test/compute/test_brightbox.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_brightbox.py b/libcloud/test/compute/test_brightbox.py
index 95c0648..b9f3ce2 100644
--- a/libcloud/test/compute/test_brightbox.py
+++ b/libcloud/test/compute/test_brightbox.py
@@ -285,13 +285,16 @@ class BrightboxMockHttp(MockHttp):
                 return self.response(httplib.OK, self.fixtures.load('list_zones.json'))
     def _2_0_zones(self, method, url, body, headers):
         return self.response(httplib.BAD_REQUEST, '{"error_name":"unrecognised_endpoint",
"errors": ["The request was for an unrecognised API endpoint"]}')
-        
+
     def _1_0_cloud_ips(self, method, url, body, headers):
         if method == 'GET':
             return self.response(httplib.OK, self.fixtures.load('list_cloud_ips.json'))
         elif method == 'POST':
-            body = json.loads(body)
+            if body:
+                body = json.loads(body)
+
             node = json.loads(self.fixtures.load('create_cloud_ip.json'))
+
             if 'reverse_dns' in body:
                 node['reverse_dns'] = body['reverse_dns']
             return self.response(httplib.ACCEPTED, json.dumps(node))
@@ -305,7 +308,7 @@ class BrightboxMockHttp(MockHttp):
                 return self.response(httplib.OK, '')
             else:
                 return self.response(httplib.BAD_REQUEST, '{"error_name":"bad dns", "errors":
["Bad dns"]}')
-            
+
     def _1_0_cloud_ips_cip_jsjc5_map(self, method, url, body, headers):
         if method == 'POST':
             body = json.loads(body)


Mime
View raw message