Make FakeSwiftCall.DUMMY_VALUE a bespoke singleton
In test assertion failure messages the DUMMY_VALUE would be shown as <object object ...> which is not immediately recognisable as the dummy value.. This change makes the DUMMY_VALUE show as <test.unit.common.middleware.helpers.FakeSwiftDummyValue object ...>. Change-Id: I73fac245c65c48d45e4919c6f15688d482148407 Related-Change: I332ce724aa10287800cbec8ca21aacc3bbd3c22a
This commit is contained in:
parent
0cdd3915c4
commit
2f74376e7e
@ -51,11 +51,21 @@ class LeakTrackingIter(object):
|
||||
self.mark_closed(self.key)
|
||||
|
||||
|
||||
class FakeSwiftDummyValue:
|
||||
_instance = None
|
||||
|
||||
@classmethod
|
||||
def singleton(cls):
|
||||
if not cls._instance:
|
||||
cls._instance = FakeSwiftDummyValue()
|
||||
return cls._instance
|
||||
|
||||
|
||||
class FakeSwiftCall(object):
|
||||
"""
|
||||
Encapsulate properties of a request captured by FakeSwift.
|
||||
"""
|
||||
DUMMY_VALUE = object()
|
||||
DUMMY_VALUE = FakeSwiftDummyValue.singleton()
|
||||
|
||||
def __init__(self, req):
|
||||
self.req = req
|
||||
|
Loading…
x
Reference in New Issue
Block a user