Updated tests on bug, when get list returns deleted items
In I4d2f44fa149aee564c62a69822c6ad79de5bba8a we introduced new _get_model_list method that introduces unify way for retrieving models from db. This commit adds tests that do checks on bug 1761956, when selecting with filter() method could return deleted entites. Change-Id: I12df4af70bcc25654a0fb276ea7145d772d891e2 Related-Bug: 1761956
This commit is contained in:
@@ -249,13 +249,21 @@ class DbGoalTestCase(base.DbTestCase):
|
||||
name="GOAL_2",
|
||||
display_name='Goal 2',
|
||||
)
|
||||
goal3 = utils.create_test_goal(
|
||||
id=3,
|
||||
uuid=w_utils.generate_uuid(),
|
||||
name="GOAL_3",
|
||||
display_name='Goal 3',
|
||||
)
|
||||
|
||||
res = self.dbapi.get_goal_list(self.context,
|
||||
filters={'display_name': 'Goal 1'})
|
||||
self.dbapi.soft_delete_goal(goal3['uuid'])
|
||||
|
||||
res = self.dbapi.get_goal_list(
|
||||
self.context, filters={'display_name': 'Goal 1'})
|
||||
self.assertEqual([goal1['uuid']], [r.uuid for r in res])
|
||||
|
||||
res = self.dbapi.get_goal_list(self.context,
|
||||
filters={'display_name': 'Goal 3'})
|
||||
res = self.dbapi.get_goal_list(
|
||||
self.context, filters={'display_name': 'Goal 3'})
|
||||
self.assertEqual([], [r.uuid for r in res])
|
||||
|
||||
res = self.dbapi.get_goal_list(
|
||||
@@ -263,10 +271,13 @@ class DbGoalTestCase(base.DbTestCase):
|
||||
self.assertEqual([goal1['uuid']], [r.uuid for r in res])
|
||||
|
||||
res = self.dbapi.get_goal_list(
|
||||
self.context,
|
||||
filters={'display_name': 'Goal 2'})
|
||||
self.context, filters={'display_name': 'Goal 2'})
|
||||
self.assertEqual([goal2['uuid']], [r.uuid for r in res])
|
||||
|
||||
res = self.dbapi.get_goal_list(
|
||||
self.context, filters={'uuid': goal3['uuid']})
|
||||
self.assertEqual([], [r.uuid for r in res])
|
||||
|
||||
def test_get_goal_by_uuid(self):
|
||||
efficacy_spec = [{"unit": "%", "name": "dummy",
|
||||
"schema": "Range(min=0, max=100, min_included=True, "
|
||||
|
||||
Reference in New Issue
Block a user