test(proxy): fix proxy-transport tests

Change-Id: Ibc05d6949221367a21b493f75ff0b4f0350ee265
This commit is contained in:
Zhihao Yuan 2013-09-20 13:57:36 -04:00 committed by Alejandro Cabrera
parent ca26627ec4
commit dc549abbc4
3 changed files with 7 additions and 12 deletions

View File

@ -8,7 +8,6 @@ msgpack-python
pymongo>=2.4
python-keystoneclient>=0.3.2
python-memcached
redis
simplejson>=2.0.9
WebOb>=1.2.3,<1.3
stevedore>=0.10

View File

@ -18,7 +18,6 @@ import json
import random
import falcon
import redis
from marconi.queues import bootstrap
@ -47,10 +46,7 @@ class CatalogTest(base.TestBase):
for server in self.servers:
self.simulate_delete('/v1/partitions/' + server.name)
# TODO(zyuan): replace this with an proxy-storage
# API call to clean up the catalogs
client = redis.StrictRedis()
client.flushdb()
# TODO(zyuan): use a storage API call to cleanup the catalogs
super(CatalogTest, self).tearDown()
@ -59,7 +55,7 @@ class CatalogTest(base.TestBase):
[server.name for server in self.servers],
self.urls,
random.sample(xrange(100), len(self.urls))):
doc = {'nodes': [url], 'weight': weight}
doc = {'hosts': [url], 'weight': weight}
self.simulate_put('/v1/partitions/' + name,
body=json.dumps(doc))
self.assertEquals(self.srmock.status, falcon.HTTP_201)

View File

@ -38,7 +38,7 @@ class PartitionTest(base.TestBase):
self.simulate_get(self.partition)
self.assertEquals(self.srmock.status, falcon.HTTP_404)
doc = {'nodes': ['url'],
doc = {'hosts': ['url'],
'weight': 10}
# Create
@ -74,7 +74,7 @@ class PartitionTest(base.TestBase):
# Insert
for n in range(1, 11):
doc = {'nodes': map(str, range(n)),
doc = {'hosts': map(str, range(n)),
'weight': n}
self.simulate_put(self.partition + str(n),
@ -100,8 +100,8 @@ class PartitionTest(base.TestBase):
self.assertEquals(self.srmock.status, falcon.HTTP_400)
# Bad fields
invalid_nodes = [1, {}, {'nodes': 1}, {'nodes': []}]
invalid_weights = [{'nodes': ['url']}]
invalid_nodes = [1, {}, {'hosts': 1}, {'hosts': []}]
invalid_weights = [{'hosts': ['url']}]
invalid_weights.append(copy.copy(invalid_weights[0]))
invalid_weights[1]['weight'] = 3.14
@ -111,7 +111,7 @@ class PartitionTest(base.TestBase):
self.assertEquals(self.srmock.status, falcon.HTTP_400)
def test_reserved_partition(self):
doc = {'nodes': ['url'],
doc = {'hosts': ['url'],
'weight': 10}
self.simulate_put('/v1/partitions/__cplusplus',