summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorCerberus <matt.dietz@rackspace.com>2010-09-25 13:35:23 -0500
committerCerberus <matt.dietz@rackspace.com>2010-09-25 13:35:23 -0500
commite627748aec6a4747e22975d6cd59c8f20bc00c70 (patch)
tree287d3e97ebf69e2c901abdabf85c0aed49fe9b7e /nova/tests
parent307b16447a16e438d78b8149418c0ef728c5300e (diff)
downloadnova-e627748aec6a4747e22975d6cd59c8f20bc00c70.tar.gz
nova-e627748aec6a4747e22975d6cd59c8f20bc00c70.tar.xz
nova-e627748aec6a4747e22975d6cd59c8f20bc00c70.zip
Modification of test stubbing to match new domain requirements for the router, and removal of the unnecessary rackspace base controller
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/rackspace/auth.py4
-rw-r--r--nova/tests/api/rackspace/servers.py4
-rw-r--r--nova/tests/api/rackspace/test_helper.py30
3 files changed, 24 insertions, 14 deletions
diff --git a/nova/tests/api/rackspace/auth.py b/nova/tests/api/rackspace/auth.py
index 429c22ad2..a6e10970f 100644
--- a/nova/tests/api/rackspace/auth.py
+++ b/nova/tests/api/rackspace/auth.py
@@ -15,8 +15,8 @@ class Test(unittest.TestCase):
'__init__', test_helper.fake_auth_init)
test_helper.FakeAuthManager.auth_data = {}
test_helper.FakeAuthDatabase.data = {}
- self.stubs.Set(nova.api.rackspace, 'RateLimitingMiddleware',
- test_helper.FakeRateLimiter)
+ test_helper.stub_out_rate_limiting(self.stubs)
+ test_helper.stub_for_testing(self.stubs)
def tearDown(self):
self.stubs.UnsetAll()
diff --git a/nova/tests/api/rackspace/servers.py b/nova/tests/api/rackspace/servers.py
index 6addc4614..e50581632 100644
--- a/nova/tests/api/rackspace/servers.py
+++ b/nova/tests/api/rackspace/servers.py
@@ -27,13 +27,15 @@ class ServersTest(unittest.TestCase):
self.stubs = stubout.StubOutForTesting()
test_helper.FakeAuthManager.auth_data = {}
test_helper.FakeAuthDatabase.data = {}
+ test_helper.stub_for_testing(self.stubs)
+ test_helper.stub_out_rate_limiting(self.stubs)
test_helper.stub_out_auth(self.stubs)
def tearDown(self):
self.stubs.UnsetAll()
def test_get_server_list(self):
- req = webob.Request.blank('/v1.0/servers/')
+ req = webob.Request.blank('/v1.0/servers')
res = req.get_response(nova.api.API())
print res
diff --git a/nova/tests/api/rackspace/test_helper.py b/nova/tests/api/rackspace/test_helper.py
index 784f3e466..971eaf20a 100644
--- a/nova/tests/api/rackspace/test_helper.py
+++ b/nova/tests/api/rackspace/test_helper.py
@@ -5,6 +5,9 @@ import datetime
from nova.wsgi import Router
from nova import auth
import nova.api.rackspace.auth
+from nova import flags
+
+FLAGS = flags.FLAGS
class Context(object):
pass
@@ -26,30 +29,35 @@ def fake_auth_init(self):
self.auth = FakeAuthManager()
self.host = 'foo'
+@webob.dec.wsgify
+def fake_wsgi(self, req):
+ return self.application
+
def stub_out_auth(stubs):
def fake_auth_init(self, app):
self.application = app
+
+ stubs.Set(nova.api.rackspace.AuthMiddleware,
+ '__init__', fake_auth_init)
+ stubs.Set(nova.api.rackspace.AuthMiddleware,
+ '__call__', fake_wsgi)
+def stub_out_rate_limiting(stubs):
def fake_rate_init(self, app):
super(nova.api.rackspace.RateLimitingMiddleware, self).__init__(app)
self.application = app
- @webob.dec.wsgify
- def fake_wsgi(self, req):
- return self.application
-
- def get_my_ip():
- return '127.0.0.1'
-
- stubs.Set(nova.api.rackspace.AuthMiddleware,
- '__init__', fake_auth_init)
stubs.Set(nova.api.rackspace.RateLimitingMiddleware,
'__init__', fake_rate_init)
- stubs.Set(nova.api.rackspace.AuthMiddleware,
- '__call__', fake_wsgi)
+
stubs.Set(nova.api.rackspace.RateLimitingMiddleware,
'__call__', fake_wsgi)
+
+def stub_for_testing(stubs):
+ def get_my_ip():
+ return '127.0.0.1'
stubs.Set(nova.utils, 'get_my_ip', get_my_ip)
+ FLAGS.FAKE_subdomain = 'rs'
class FakeAuthDatabase(object):
data = {}