Files
python-ironicclient/ironicclient/tests/unit/osc/fakes.py
Ruby Loo 07fc85c5e1 Replace six.iteritems() with .items()
As mentioned in the developer's guide[0] and in a discussion[1],
we shouldn't use six.iteritems() unless there's a good reason (eg
large data set).

Since there's no need to use six.iteritems() in the places where
it is being used, this patch replaces them with items().

[0] http://docs.openstack.org/infra/manual/developers.html#peer-review
[1] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: If91afd37a7bf42dcbcf9dcd70fbbe82787de850e
2015-09-28 18:20:00 +00:00

57 lines
1.6 KiB
Python

#
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import sys
AUTH_TOKEN = "foobar"
AUTH_URL = "http://0.0.0.0"
class FakeApp(object):
def __init__(self):
_stdout = None
self.client_manager = None
self.stdin = sys.stdin
self.stdout = _stdout or sys.stdout
self.stderr = sys.stderr
self.restapi = None
class FakeClientManager(object):
def __init__(self):
self.identity = None
self.auth_ref = None
class FakeResource(object):
def __init__(self, manager, info, loaded=False):
self.__name__ = type(self).__name__
self.manager = manager
self._info = info
self._add_details(info)
self._loaded = loaded
def _add_details(self, info):
for (k, v) in info.items():
setattr(self, k, v)
def __repr__(self):
reprkeys = sorted(k for k in self.__dict__.keys() if k[0] != '_' and
k != 'manager')
info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys)
return "<%s %s>" % (self.__class__.__name__, info)