Delete test file that should have been removed and fix checks (#15739)

* Delete test file that should have been removed

* Add more insights env variables
This commit is contained in:
Alan Rominger 2025-01-10 13:10:24 -05:00 committed by GitHub
parent 2d7bbc4ec8
commit 3e50b019e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 50 deletions

View File

@ -1,4 +1,6 @@
{
"INSIGHTS_USER": "fooo",
"INSIGHTS_PASSWORD": "fooo"
"INSIGHTS_PASSWORD": "fooo",
"INSIGHTS_CLIENT_ID": "fooo",
"INSIGHTS_CLIENT_SECRET": "fooo"
}

View File

@ -1,49 +0,0 @@
import pytest
from awx.main.migrations import _rbac as rbac
from awx.main.models import UnifiedJobTemplate, InventorySource, Inventory, JobTemplate, Project, Organization
@pytest.mark.django_db
def test_implied_organization_subquery_inventory():
orgs = []
for i in range(3):
orgs.append(Organization.objects.create(name='foo{}'.format(i)))
orgs.append(orgs[0])
for i in range(4):
org = orgs[i]
if i == 2:
inventory = Inventory.objects.create(name='foo{}'.format(i))
else:
inventory = Inventory.objects.create(name='foo{}'.format(i), organization=org)
inv_src = InventorySource.objects.create(name='foo{}'.format(i), inventory=inventory, source='ec2')
sources = UnifiedJobTemplate.objects.annotate(test_field=rbac.implicit_org_subquery(UnifiedJobTemplate, InventorySource))
for inv_src in sources:
assert inv_src.test_field == inv_src.inventory.organization_id
@pytest.mark.django_db
def test_implied_organization_subquery_job_template():
jts = []
for i in range(5):
if i <= 3:
org = Organization.objects.create(name='foo{}'.format(i))
else:
org = None
if i <= 4:
proj = Project.objects.create(name='foo{}'.format(i), organization=org)
else:
proj = None
jts.append(JobTemplate.objects.create(name='foo{}'.format(i), project=proj))
# test case of sharing same org
jts[2].project.organization = jts[3].project.organization
jts[2].save()
ujts = UnifiedJobTemplate.objects.annotate(test_field=rbac.implicit_org_subquery(UnifiedJobTemplate, JobTemplate))
for jt in ujts:
if not isinstance(jt, JobTemplate): # some are projects
assert jt.test_field is None
else:
if jt.project is None:
assert jt.test_field is None
else:
assert jt.test_field == jt.project.organization_id