libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject svn commit: r919928 - in /incubator/libcloud/trunk/test: ./ fixtures/rackspace/
Date Sun, 07 Mar 2010 05:20:41 GMT
Author: jerry
Date: Sun Mar  7 05:20:41 2010
New Revision: 919928

URL: http://svn.apache.org/viewvc?rev=919928&view=rev
Log:
Converted RackspaceMockHttp to use FileFixtures

Added:
    incubator/libcloud/trunk/test/fixtures/rackspace/
    incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_flavors_detail.xml
    incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_images_detail.xml
    incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers.xml
    incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail.xml
    incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_empty.xml
    incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_metadata.xml
    incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_metadata.xml
Modified:
    incubator/libcloud/trunk/test/test_rackspace.py

Added: incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_flavors_detail.xml
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_flavors_detail.xml?rev=919928&view=auto
==============================================================================
--- incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_flavors_detail.xml (added)
+++ incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_flavors_detail.xml Sun Mar  7
05:20:41 2010
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><flavors xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><flavor
disk="10" ram="256" name="256 slice" id="1"/><flavor disk="20" ram="512" name="512 slice"
id="2"/><flavor disk="40" ram="1024" name="1GB slice" id="3"/><flavor disk="80"
ram="2048" name="2GB slice" id="4"/><flavor disk="160" ram="4096" name="4GB slice" id="5"/><flavor
disk="320" ram="8192" name="8GB slice" id="6"/><flavor disk="620" ram="15872" name="15.5GB
slice" id="7"/></flavors>
+

Added: incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_images_detail.xml
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_images_detail.xml?rev=919928&view=auto
==============================================================================
--- incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_images_detail.xml (added)
+++ incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_images_detail.xml Sun Mar  7
05:20:41 2010
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><images xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><image
status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="CentOS
5.2" id="2"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00"
name="Gentoo 2008.0" id="3"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00" name="Debian 5.0 (lenny)" id="4"/><image status="ACTIVE"
created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="Fedora 10 (Cambridge)"
id="5"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00"
name="CentOS 5.3" id="7"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00" name="Ubuntu 9.04 (jaunty)" id="8"/><image status="ACTIVE"
created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="Arch 2009.0
 2" id="9"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00"
name="Ubuntu 8.04.2 LTS (hardy)" id="10"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00" name="Ubuntu 8.10 (intrepid)" id="11"/><image status="ACTIVE"
created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="Red Hat EL 5.3"
id="12"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00"
name="Fedora 11 (Leonidas)" id="13"/><image status="ACTIVE" progress="100" created="2009-11-29T20:22:09-06:00"
updated="2009-11-29T20:24:08-06:00" serverId="91221" name="daily" id="191234"/></images>

Added: incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers.xml
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers.xml?rev=919928&view=auto
==============================================================================
--- incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers.xml (added)
+++ incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers.xml Sun Mar  7 05:20:41
2010
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><server xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"
status="BUILD" progress="0" hostId="9dd380940fcbe39cb30255ed4664f1f3" flavorId="1" imageId="11"
adminPass="racktestvJq7d3" id="72258" name="racktest"><metadata/><addresses><public><ip
addr="67.23.21.33"/></public><private><ip addr="10.176.168.218"/></private></addresses></server>

Added: incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail.xml
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail.xml?rev=919928&view=auto
==============================================================================
--- incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail.xml (added)
+++ incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail.xml Sun Mar  7
05:20:41 2010
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><servers xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><server
status="ACTIVE" progress="100" hostId="9dd380940fcbe39cb30255ed4664f1f3" flavorId="1" imageId="11"
id="72258" name="racktest"><metadata/><addresses><public><ip addr="67.23.21.33"/></public><private><ip
addr="10.176.168.218"/></private></addresses></server></servers>

Added: incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_empty.xml
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_empty.xml?rev=919928&view=auto
==============================================================================
--- incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_empty.xml (added)
+++ incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_empty.xml Sun
Mar  7 05:20:41 2010
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><servers xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"/>

Added: incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_metadata.xml
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_metadata.xml?rev=919928&view=auto
==============================================================================
--- incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_metadata.xml (added)
+++ incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_detail_metadata.xml Sun
Mar  7 05:20:41 2010
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><servers xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><server
status="ACTIVE" progress="100" hostId="9dd380940fcbe39cb30255ed4664f1f3" flavorId="1" imageId="11"
id="72258" name="racktest"><metadata><meta key="somekey">somevalue</meta></metadata><addresses><public><ip
addr="67.23.21.33"/></public><private><ip addr="10.176.168.218"/></private></addresses></server></servers>

Added: incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_metadata.xml
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_metadata.xml?rev=919928&view=auto
==============================================================================
--- incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_metadata.xml (added)
+++ incubator/libcloud/trunk/test/fixtures/rackspace/v1_slug_servers_metadata.xml Sun Mar
 7 05:20:41 2010
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><server xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"
status="BUILD" progress="0" hostId="9dd380940fcbe39cb30255ed4664f1f3" flavorId="1" imageId="11"
adminPass="racktestvJq7d3" id="72258" name="racktest"><metadata><meta key="a">b</meta><meta
key="c">d</meta></metadata><addresses><public><ip addr="67.23.21.33"/></public><private><ip
addr="10.176.168.218"/></private></addresses></server>

Modified: incubator/libcloud/trunk/test/test_rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_rackspace.py?rev=919928&r1=919927&r2=919928&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_rackspace.py (original)
+++ incubator/libcloud/trunk/test/test_rackspace.py Sun Mar  7 05:20:41 2010
@@ -20,6 +20,8 @@
 from libcloud.base import Node, NodeImage, NodeSize
 
 from test import MockHttp, TestCaseMixin
+from test.file_fixtures import FileFixtures
+
 from secrets import RACKSPACE_USER, RACKSPACE_KEY
 import httplib
 
@@ -103,6 +105,8 @@
 
 class RackspaceMockHttp(MockHttp):
 
+    fixtures = FileFixtures('rackspace')
+
     # fake auth token response
     def _v1_0(self, method, url, body, headers):
         headers = {'x-server-management-url': 'https://servers.api.rackspacecloud.com/v1.0/slug',
@@ -110,37 +114,37 @@
                    'x-cdn-management-url': 'https://cdn.clouddrive.com/v1/MossoCloudFS_FE011C19-CF86-4F87-BE5D-9229145D7A06',
                    'x-storage-token': 'FE011C19-CF86-4F87-BE5D-9229145D7A06',
                    'x-storage-url': 'https://storage4.clouddrive.com/v1/MossoCloudFS_FE011C19-CF86-4F87-BE5D-9229145D7A06'}
-
         return (httplib.NO_CONTENT, "", headers, httplib.responses[httplib.NO_CONTENT])
+
     def _v1_0_UNAUTHORIZED(self, method, url, body, headers):
         return  (httplib.UNAUTHORIZED, "", {}, httplib.responses[httplib.UNAUTHORIZED])
 
     def _v1_0_slug_servers_detail_EMPTY(self, method, url, body, headers):
-        body = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><servers
xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"/>"""
+        body = self.fixtures.load('v1_slug_servers_detail_empty.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _v1_0_slug_servers_detail(self, method, url, body, headers):
-        body = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><servers
xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><server status="ACTIVE" progress="100"
hostId="9dd380940fcbe39cb30255ed4664f1f3" flavorId="1" imageId="11" id="72258" name="racktest"><metadata/><addresses><public><ip
addr="67.23.21.33"/></public><private><ip addr="10.176.168.218"/></private></addresses></server></servers>"""
+        body = self.fixtures.load('v1_slug_servers_detail.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _v1_0_slug_servers_detail_METADATA(self, method, url, body, headers):
-        body = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><servers
xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><server status="ACTIVE" progress="100"
hostId="9dd380940fcbe39cb30255ed4664f1f3" flavorId="1" imageId="11" id="72258" name="racktest"><metadata><meta
key="somekey">somevalue</meta></metadata><addresses><public><ip
addr="67.23.21.33"/></public><private><ip addr="10.176.168.218"/></private></addresses></server></servers>"""
+        body = self.fixtures.load('v1_slug_servers_detail_metadata.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _v1_0_slug_flavors_detail(self, method, url, body, headers):
-        body = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><flavors
xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><flavor disk="10" ram="256"
name="256 slice" id="1"/><flavor disk="20" ram="512" name="512 slice" id="2"/><flavor
disk="40" ram="1024" name="1GB slice" id="3"/><flavor disk="80" ram="2048" name="2GB
slice" id="4"/><flavor disk="160" ram="4096" name="4GB slice" id="5"/><flavor
disk="320" ram="8192" name="8GB slice" id="6"/><flavor disk="620" ram="15872" name="15.5GB
slice" id="7"/></flavors>"""
+        body = self.fixtures.load('v1_slug_flavors_detail.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _v1_0_slug_images_detail(self, method, url, body, headers):
-        body = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><images
xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00" name="CentOS 5.2" id="2"/><image status="ACTIVE"
created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="Gentoo 2008.0"
id="3"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00"
name="Debian 5.0 (lenny)" id="4"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00" name="Fedora 10 (Cambridge)" id="5"/><image status="ACTIVE"
created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="CentOS 5.3"
id="7"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00"
name="Ubuntu 9.04 (jaunty)" id="8"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00"
  name="Arch 2009.02" id="9"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00" name="Ubuntu 8.04.2 LTS (hardy)" id="10"/><image
status="ACTIVE" created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="Ubuntu
8.10 (intrepid)" id="11"/><image status="ACTIVE" created="2009-07-20T09:14:37-05:00"
updated="2009-07-20T09:14:37-05:00" name="Red Hat EL 5.3" id="12"/><image status="ACTIVE"
created="2009-07-20T09:14:37-05:00" updated="2009-07-20T09:14:37-05:00" name="Fedora 11 (Leonidas)"
id="13"/><image status="ACTIVE" progress="100" created="2009-11-29T20:22:09-06:00" updated="2009-11-29T20:24:08-06:00"
serverId="91221" name="daily" id="191234"/></images>"""
+        body = self.fixtures.load('v1_slug_images_detail.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
         
     def _v1_0_slug_servers(self, method, url, body, headers):
-        body = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><server
xmlns="http://docs.rackspacecloud.com/servers/api/v1.0" status="BUILD" progress="0" hostId="9dd380940fcbe39cb30255ed4664f1f3"
flavorId="1" imageId="11" adminPass="racktestvJq7d3" id="72258" name="racktest"><metadata/><addresses><public><ip
addr="67.23.21.33"/></public><private><ip addr="10.176.168.218"/></private></addresses></server>"""
+        body = self.fixtures.load('v1_slug_servers.xml')
         return (httplib.ACCEPTED, body, {}, httplib.responses[httplib.ACCEPTED])
 
     def _v1_0_slug_servers_METADATA(self, method, url, body, headers):
-        body = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><server
xmlns="http://docs.rackspacecloud.com/servers/api/v1.0" status="BUILD" progress="0" hostId="9dd380940fcbe39cb30255ed4664f1f3"
flavorId="1" imageId="11" adminPass="racktestvJq7d3" id="72258" name="racktest"><metadata><meta
key="a">b</meta><meta key="c">d</meta></metadata><addresses><public><ip
addr="67.23.21.33"/></public><private><ip addr="10.176.168.218"/></private></addresses></server>"""
+        body = self.fixtures.load('v1_slug_servers_metadata.xml')
         return (httplib.ACCEPTED, body, {}, httplib.responses[httplib.ACCEPTED])
 
     def _v1_0_slug_servers_72258_action(self, method, url, body, headers):



Mime
View raw message