Fix get_action_plan_list filter error
When using 'query.filter_by(deleted_at=None)' Will generate the incorrect SQL 'audits.deleted_at', as below: SELECT * FROM action_plans INNER JOIN audits ON audits.id = action_plans.audit_id WHERE audits.uuid = '' AND audits.deleted_at IS NULL ORDER BY action_plans.id ASC The correct filter field is 'action_plans.deleted_at' Change-Id: Ie05f35233f78e82bc7af2c26c9effd62ea5f86ab Closes-Bug: #1698720
This commit is contained in:
@@ -307,6 +307,14 @@ class DbActionPlanTestCase(base.DbTestCase):
|
||||
for r in res:
|
||||
self.assertEqual(audit['id'], r.audit_id)
|
||||
|
||||
self.dbapi.soft_delete_action_plan(action_plan1['uuid'])
|
||||
res = self.dbapi.get_action_plan_list(
|
||||
self.context,
|
||||
filters={'audit_uuid': audit['uuid']})
|
||||
|
||||
self.assertEqual([action_plan2['id']], [r.id for r in res])
|
||||
self.assertNotEqual([action_plan1['id']], [r.id for r in res])
|
||||
|
||||
def test_get_action_plan_list_with_filter_by_uuid(self):
|
||||
action_plan = self._create_test_action_plan()
|
||||
res = self.dbapi.get_action_plan_list(
|
||||
|
||||
Reference in New Issue
Block a user