summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Rominger <arominge@redhat.com>2025-01-10 19:10:24 +0100
committerGitHub <noreply@github.com>2025-01-10 19:10:24 +0100
commit3e50b019e07d166844c5edbc8ecc2fbaefc6170b (patch)
tree84d85e661f110c821fb28398e1e64607b8648f92
parentAAP-37080 Delete the cleanup_tokens system job template (#15711) (diff)
downloadawx-3e50b019e07d166844c5edbc8ecc2fbaefc6170b.tar.xz
awx-3e50b019e07d166844c5edbc8ecc2fbaefc6170b.zip
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
-rw-r--r--awx/main/tests/data/inventory/plugins/insights/env.json4
-rw-r--r--awx/main/tests/functional/rbac/test_rbac_migration.py49
2 files changed, 3 insertions, 50 deletions
diff --git a/awx/main/tests/data/inventory/plugins/insights/env.json b/awx/main/tests/data/inventory/plugins/insights/env.json
index b87328e761..bbece6a48f 100644
--- a/awx/main/tests/data/inventory/plugins/insights/env.json
+++ b/awx/main/tests/data/inventory/plugins/insights/env.json
@@ -1,4 +1,6 @@
{
"INSIGHTS_USER": "fooo",
- "INSIGHTS_PASSWORD": "fooo"
+ "INSIGHTS_PASSWORD": "fooo",
+ "INSIGHTS_CLIENT_ID": "fooo",
+ "INSIGHTS_CLIENT_SECRET": "fooo"
}
diff --git a/awx/main/tests/functional/rbac/test_rbac_migration.py b/awx/main/tests/functional/rbac/test_rbac_migration.py
deleted file mode 100644
index 8ee411ba1a..0000000000
--- a/awx/main/tests/functional/rbac/test_rbac_migration.py
+++ /dev/null
@@ -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