From d0b99b51c0d46284bf03b75d42f11f4e687314af Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Mon, 11 Nov 2013 13:06:40 +0000 Subject: [PATCH] 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 --- ironicclient/tests/test_http.py | 3 --- ironicclient/tests/utils.py | 16 ++++++++-------- ironicclient/tests/v1/test_chassis.py | 4 ++-- ironicclient/tests/v1/test_node.py | 4 ++-- ironicclient/tests/v1/test_port.py | 4 ++-- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/ironicclient/tests/test_http.py b/ironicclient/tests/test_http.py index e7e0286a4..cb6c5115b 100644 --- a/ironicclient/tests/test_http.py +++ b/ironicclient/tests/test_http.py @@ -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): diff --git a/ironicclient/tests/utils.py b/ironicclient/tests/utils.py index 09cd98841..8290ec0df 100644 --- a/ironicclient/tests/utils.py +++ b/ironicclient/tests/utils.py @@ -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): diff --git a/ironicclient/tests/v1/test_chassis.py b/ironicclient/tests/v1/test_chassis.py index f0aad9775..1e72a06ff 100644 --- a/ironicclient/tests/v1/test_chassis.py +++ b/ironicclient/tests/v1/test_chassis.py @@ -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): diff --git a/ironicclient/tests/v1/test_node.py b/ironicclient/tests/v1/test_node.py index d0037ca5c..dd12eccc7 100644 --- a/ironicclient/tests/v1/test_node.py +++ b/ironicclient/tests/v1/test_node.py @@ -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): diff --git a/ironicclient/tests/v1/test_port.py b/ironicclient/tests/v1/test_port.py index 77ce8c554..08bfa5c69 100644 --- a/ironicclient/tests/v1/test_port.py +++ b/ironicclient/tests/v1/test_port.py @@ -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):