Merge "Rename variables called 'fixtures'"

This commit is contained in:
Jenkins 2013-11-12 16:51:35 +00:00 committed by Gerrit Code Review
commit d99ce7f28f
5 changed files with 14 additions and 17 deletions

View File

@ -17,9 +17,6 @@ from ironicclient.common import http
from ironicclient.tests import utils
fixtures = {}
class HttpClientTest(utils.BaseTestCase):
def test_url_generation_trailing_slash_in_base(self):

View File

@ -30,23 +30,23 @@ class BaseTestCase(testtools.TestCase):
class FakeAPI(object):
def __init__(self, fixtures):
self.fixtures = fixtures
def __init__(self, responses):
self.responses = responses
self.calls = []
def _request(self, method, url, headers=None, body=None):
call = (method, url, headers or {}, body)
self.calls.append(call)
return self.fixtures[url][method]
return self.responses[url][method]
def raw_request(self, *args, **kwargs):
fixture = self._request(*args, **kwargs)
body_iter = http.ResponseBodyIterator(six.StringIO(fixture[1]))
return FakeResponse(fixture[0]), body_iter
response = self._request(*args, **kwargs)
body_iter = http.ResponseBodyIterator(six.StringIO(response[1]))
return FakeResponse(response[0]), body_iter
def json_request(self, *args, **kwargs):
fixture = self._request(*args, **kwargs)
return FakeResponse(fixture[0]), fixture[1]
response = self._request(*args, **kwargs)
return FakeResponse(response[0]), response[1]
class FakeResponse(object):

View File

@ -45,7 +45,7 @@ UPDATED_CHASSIS = copy.deepcopy(CHASSIS)
NEW_DESCR = 'new-description'
UPDATED_CHASSIS['description'] = NEW_DESCR
fixtures = {
fake_responses = {
'/v1/chassis':
{
'GET': (
@ -86,7 +86,7 @@ class ChassisManagerTest(testtools.TestCase):
def setUp(self):
super(ChassisManagerTest, self).setUp()
self.api = utils.FakeAPI(fixtures)
self.api = utils.FakeAPI(fake_responses)
self.mgr = ironicclient.v1.chassis.ChassisManager(self.api)
def test_chassis_list(self):

View File

@ -48,7 +48,7 @@ UPDATED_NODE = copy.deepcopy(NODE)
NEW_DRIVER = 'new-driver'
UPDATED_NODE['driver'] = NEW_DRIVER
fixtures = {
fake_responses = {
'/v1/nodes':
{
'GET': (
@ -96,7 +96,7 @@ class NodeManagerTest(testtools.TestCase):
def setUp(self):
super(NodeManagerTest, self).setUp()
self.api = utils.FakeAPI(fixtures)
self.api = utils.FakeAPI(fake_responses)
self.mgr = ironicclient.v1.node.NodeManager(self.api)
def test_node_list(self):

View File

@ -38,7 +38,7 @@ UPDATED_PORT = copy.deepcopy(PORT)
NEW_ADDR = 'AA:AA:AA:AA:AA:AA'
UPDATED_PORT['address'] = NEW_ADDR
fixtures = {
fake_responses = {
'/v1/ports':
{
'GET': (
@ -72,7 +72,7 @@ class PortManagerTest(testtools.TestCase):
def setUp(self):
super(PortManagerTest, self).setUp()
self.api = utils.FakeAPI(fixtures)
self.api = utils.FakeAPI(fake_responses)
self.mgr = ironicclient.v1.port.PortManager(self.api)
def test_ports_list(self):