Merge "Rename variables called 'fixtures'"
This commit is contained in:
commit
d99ce7f28f
@ -17,9 +17,6 @@ from ironicclient.common import http
|
|||||||
from ironicclient.tests import utils
|
from ironicclient.tests import utils
|
||||||
|
|
||||||
|
|
||||||
fixtures = {}
|
|
||||||
|
|
||||||
|
|
||||||
class HttpClientTest(utils.BaseTestCase):
|
class HttpClientTest(utils.BaseTestCase):
|
||||||
|
|
||||||
def test_url_generation_trailing_slash_in_base(self):
|
def test_url_generation_trailing_slash_in_base(self):
|
||||||
|
@ -30,23 +30,23 @@ class BaseTestCase(testtools.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class FakeAPI(object):
|
class FakeAPI(object):
|
||||||
def __init__(self, fixtures):
|
def __init__(self, responses):
|
||||||
self.fixtures = fixtures
|
self.responses = responses
|
||||||
self.calls = []
|
self.calls = []
|
||||||
|
|
||||||
def _request(self, method, url, headers=None, body=None):
|
def _request(self, method, url, headers=None, body=None):
|
||||||
call = (method, url, headers or {}, body)
|
call = (method, url, headers or {}, body)
|
||||||
self.calls.append(call)
|
self.calls.append(call)
|
||||||
return self.fixtures[url][method]
|
return self.responses[url][method]
|
||||||
|
|
||||||
def raw_request(self, *args, **kwargs):
|
def raw_request(self, *args, **kwargs):
|
||||||
fixture = self._request(*args, **kwargs)
|
response = self._request(*args, **kwargs)
|
||||||
body_iter = http.ResponseBodyIterator(six.StringIO(fixture[1]))
|
body_iter = http.ResponseBodyIterator(six.StringIO(response[1]))
|
||||||
return FakeResponse(fixture[0]), body_iter
|
return FakeResponse(response[0]), body_iter
|
||||||
|
|
||||||
def json_request(self, *args, **kwargs):
|
def json_request(self, *args, **kwargs):
|
||||||
fixture = self._request(*args, **kwargs)
|
response = self._request(*args, **kwargs)
|
||||||
return FakeResponse(fixture[0]), fixture[1]
|
return FakeResponse(response[0]), response[1]
|
||||||
|
|
||||||
|
|
||||||
class FakeResponse(object):
|
class FakeResponse(object):
|
||||||
|
@ -45,7 +45,7 @@ UPDATED_CHASSIS = copy.deepcopy(CHASSIS)
|
|||||||
NEW_DESCR = 'new-description'
|
NEW_DESCR = 'new-description'
|
||||||
UPDATED_CHASSIS['description'] = NEW_DESCR
|
UPDATED_CHASSIS['description'] = NEW_DESCR
|
||||||
|
|
||||||
fixtures = {
|
fake_responses = {
|
||||||
'/v1/chassis':
|
'/v1/chassis':
|
||||||
{
|
{
|
||||||
'GET': (
|
'GET': (
|
||||||
@ -86,7 +86,7 @@ class ChassisManagerTest(testtools.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ChassisManagerTest, self).setUp()
|
super(ChassisManagerTest, self).setUp()
|
||||||
self.api = utils.FakeAPI(fixtures)
|
self.api = utils.FakeAPI(fake_responses)
|
||||||
self.mgr = ironicclient.v1.chassis.ChassisManager(self.api)
|
self.mgr = ironicclient.v1.chassis.ChassisManager(self.api)
|
||||||
|
|
||||||
def test_chassis_list(self):
|
def test_chassis_list(self):
|
||||||
|
@ -48,7 +48,7 @@ UPDATED_NODE = copy.deepcopy(NODE)
|
|||||||
NEW_DRIVER = 'new-driver'
|
NEW_DRIVER = 'new-driver'
|
||||||
UPDATED_NODE['driver'] = NEW_DRIVER
|
UPDATED_NODE['driver'] = NEW_DRIVER
|
||||||
|
|
||||||
fixtures = {
|
fake_responses = {
|
||||||
'/v1/nodes':
|
'/v1/nodes':
|
||||||
{
|
{
|
||||||
'GET': (
|
'GET': (
|
||||||
@ -96,7 +96,7 @@ class NodeManagerTest(testtools.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(NodeManagerTest, self).setUp()
|
super(NodeManagerTest, self).setUp()
|
||||||
self.api = utils.FakeAPI(fixtures)
|
self.api = utils.FakeAPI(fake_responses)
|
||||||
self.mgr = ironicclient.v1.node.NodeManager(self.api)
|
self.mgr = ironicclient.v1.node.NodeManager(self.api)
|
||||||
|
|
||||||
def test_node_list(self):
|
def test_node_list(self):
|
||||||
|
@ -38,7 +38,7 @@ UPDATED_PORT = copy.deepcopy(PORT)
|
|||||||
NEW_ADDR = 'AA:AA:AA:AA:AA:AA'
|
NEW_ADDR = 'AA:AA:AA:AA:AA:AA'
|
||||||
UPDATED_PORT['address'] = NEW_ADDR
|
UPDATED_PORT['address'] = NEW_ADDR
|
||||||
|
|
||||||
fixtures = {
|
fake_responses = {
|
||||||
'/v1/ports':
|
'/v1/ports':
|
||||||
{
|
{
|
||||||
'GET': (
|
'GET': (
|
||||||
@ -72,7 +72,7 @@ class PortManagerTest(testtools.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(PortManagerTest, self).setUp()
|
super(PortManagerTest, self).setUp()
|
||||||
self.api = utils.FakeAPI(fixtures)
|
self.api = utils.FakeAPI(fake_responses)
|
||||||
self.mgr = ironicclient.v1.port.PortManager(self.api)
|
self.mgr = ironicclient.v1.port.PortManager(self.api)
|
||||||
|
|
||||||
def test_ports_list(self):
|
def test_ports_list(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user