Rename variables called 'fixtures'
'fixtures' is the name of a library used by OpenStack. Some variables in the code were using the same name and potentially could cause cause some confusion when reading the code. Change-Id: I25b4c969b9fcdc56d4eeb46ed8e8aa51b73682a7
This commit is contained in:
parent
3446a9734d
commit
d0b99b51c0
@ -18,9 +18,6 @@ from ironicclient.tests import utils
|
||||
from ironicclient.common import http
|
||||
|
||||
|
||||
fixtures = {}
|
||||
|
||||
|
||||
class HttpClientTest(utils.BaseTestCase):
|
||||
|
||||
def test_url_generation_trailing_slash_in_base(self):
|
||||
|
@ -29,23 +29,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):
|
||||
|
@ -44,7 +44,7 @@ UPDATED_CHASSIS = copy.deepcopy(CHASSIS)
|
||||
NEW_DESCR = 'new-description'
|
||||
UPDATED_CHASSIS['description'] = NEW_DESCR
|
||||
|
||||
fixtures = {
|
||||
fake_responses = {
|
||||
'/v1/chassis':
|
||||
{
|
||||
'GET': (
|
||||
@ -85,7 +85,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):
|
||||
|
@ -47,7 +47,7 @@ UPDATED_NODE = copy.deepcopy(NODE)
|
||||
NEW_DRIVER = 'new-driver'
|
||||
UPDATED_NODE['driver'] = NEW_DRIVER
|
||||
|
||||
fixtures = {
|
||||
fake_responses = {
|
||||
'/v1/nodes':
|
||||
{
|
||||
'GET': (
|
||||
@ -95,7 +95,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):
|
||||
|
@ -37,7 +37,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': (
|
||||
@ -71,7 +71,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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user