Process for updating queries in tests

Hi,

Below are a few queries in some tests that have yet to be updated. These are queries that still refer to deleted queries. For example, in the lines below the deleted field ‘organization’ in both the project and workflowjobtemplate model was deleted in previous migrations, yet they’re still referenced here in these tests. I’m wondering what the protocol here is when updating queries that reference deleted or renamed fields in tests.

awx/awx/main/tests/functional/test_projects.py

Line 202
assert Project.objects.filter(name=‘Project’, organization=organization).exists()

awx/awx/main/tests/functional/api/test_rbac_displays.py

Line 317

wfjt = WorkflowJobTemplate.objects.create(name=‘test’, organization=None)

Where do you see them being removed? Organization is a field on both projects and workflow templates.

Bill

In migration 0109, lines 41-49, it looks like the organization field got removed from the models project and workflowjobtemplate. Also, it looks like in the versions before the migration was committed there were quite a few queries that referred to the fields, but in the versions after the migration was commited it looks like the only queries left are in some tests. Right now in the models files too, I don’t see any organization field in the project or workflowjobtemplate models. I could definitely be mistaken about this, so it would be great if you could tell me what I am seeing wrong.

https://github.com/ansible/awx/blob/devel/awx/main/migrations/0109_v370_job_template_organization_field.py

Thank you,
Sophie

Sophie Xie (sxie2@cps.edu) said:

In migration 0109, lines 41-49, it looks like the organization field got
removed from the models project and workflowjobtemplate. Also, it looks
like in the versions before the migration was committed there were quite a
few queries that referred to the fields, but in the versions after the
migration was commited it looks like the only queries left are in some
tests. Right now in the models files too, I don't see any organization
field in the project or workflowjobtemplate models. I could definitely be
mistaken about this, so it would be great if you could tell me what I am
seeing wrong.

The migration moved 'organization' to the UnifiedJobTemplate, from which
Projects and Workflow Templates both inherit things, so they both still have
'organization' as an field/attribute.

Bill

Oh, I see. Thank you!