Merge "fix DBResourceExtendFixture fixture"
This commit is contained in:
commit
53bc87c198
@ -275,14 +275,14 @@ class RPCFixture(fixtures.Fixture):
|
||||
|
||||
class DBResourceExtendFixture(fixtures.Fixture):
|
||||
|
||||
def __init__(self, extended_methods=None):
|
||||
self.extended_methods = extended_methods or {}
|
||||
def __init__(self, extended_functions=None):
|
||||
self.extended_functions = extended_functions or {}
|
||||
|
||||
def _setUp(self):
|
||||
self._backup = copy.deepcopy(
|
||||
resource_extend._DECORATED_EXTEND_METHODS)
|
||||
resource_extend._DECORATED_EXTEND_METHODS = self.extended_methods
|
||||
resource_extend._resource_extend_functions)
|
||||
resource_extend._resource_extend_functions = self.extended_functions
|
||||
self.addCleanup(self._restore)
|
||||
|
||||
def _restore(self):
|
||||
resource_extend._DECORATED_EXTEND_METHODS = self._backup
|
||||
resource_extend._resource_extend_functions = self._backup
|
||||
|
@ -164,17 +164,17 @@ class DBResourceExtendFixtureTestCase(base.BaseTestCase):
|
||||
'a': 'A',
|
||||
'b': 'B'
|
||||
}
|
||||
orig_methods = resource_extend._DECORATED_EXTEND_METHODS
|
||||
orig_methods = resource_extend._resource_extend_functions
|
||||
self.assertNotEqual(fake_methods, orig_methods)
|
||||
|
||||
db_fixture = fixture.DBResourceExtendFixture(
|
||||
extended_methods=fake_methods)
|
||||
extended_functions=fake_methods)
|
||||
db_fixture.setUp()
|
||||
|
||||
resource_extend.register_funcs('C', (lambda x: x,))
|
||||
self.assertNotEqual(
|
||||
orig_methods, resource_extend._DECORATED_EXTEND_METHODS)
|
||||
orig_methods, resource_extend._resource_extend_functions)
|
||||
|
||||
db_fixture.cleanUp()
|
||||
self.assertEqual(
|
||||
orig_methods, resource_extend._DECORATED_EXTEND_METHODS)
|
||||
orig_methods, resource_extend._resource_extend_functions)
|
||||
|
Loading…
Reference in New Issue
Block a user