Add a test class to validate UTs fixes of new_facade flag

In I3a8bc06a671e37959e3014f8672b9a5e118c5c52, we added mocks to
avoid touching databases when switching to new engine facade.
However, currently we do not have test codes to catch those failure.
This patch adds a fake object setting new_facade to True, to validate
without I3a8bc06a671e37959e3014f8672b9a5e118c5c52, the test class
would fail.

Change-Id: I968806b237f9c1275e7624a0995189c1d0bc75fb
Closes-Bug: #1750735
This commit is contained in:
Lujin 2018-03-16 20:24:47 +09:00
parent 3ff872b913
commit 97730821ef

View File

@ -90,6 +90,30 @@ class FakeSmallNeutronObject(base.NeutronDbObject):
}
@base.NeutronObjectRegistry.register_if(False)
class FakeSmallNeutronObjectNewEngineFacade(base.NeutronDbObject):
# Version 1.0: Initial version
VERSION = '1.0'
db_model = ObjectFieldsModel
new_facade = True
primary_keys = ['field1']
foreign_keys = {
'FakeNeutronObjectCompositePrimaryKeyWithId': {'field1': 'id'},
'FakeNeutronDbObject': {'field2': 'id'},
'FakeNeutronObjectUniqueKey': {'field3': 'id'},
}
fields = {
'field1': common_types.UUIDField(),
'field2': common_types.UUIDField(),
'field3': common_types.UUIDField(),
}
@base.NeutronObjectRegistry.register_if(False)
class FakeSmallNeutronObjectWithMultipleParents(base.NeutronDbObject):
# Version 1.0: Initial version
@ -1255,6 +1279,11 @@ class BaseDbObjectNonStandardPrimaryKeyTestCase(BaseObjectIfaceTestCase):
_test_class = FakeNeutronObjectNonStandardPrimaryKey
class BaseDbObjectNewEngineFacade(BaseObjectIfaceTestCase):
_test_class = FakeSmallNeutronObjectNewEngineFacade
class BaseDbObjectCompositePrimaryKeyTestCase(BaseObjectIfaceTestCase):
_test_class = FakeNeutronObjectCompositePrimaryKey