mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
reduce test to only check project inventory connection
This commit is contained in:
parent
da39f1269a
commit
52cd4f5ef9
@ -109,47 +109,36 @@ def test_two_organizations(resourced_organization, organizations, user, get):
|
|||||||
}
|
}
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_overlapping_project(resourced_organization, organizations, user, get):
|
def test_JT_associated_with_project(organizations, project, user, get):
|
||||||
# Check correct results for two organizations are returned
|
# Check that adding a project to an organization gets the project's JT
|
||||||
|
# included in the organization's JT count
|
||||||
external_admin = user('admin', True)
|
external_admin = user('admin', True)
|
||||||
organization2 = organizations(1)[0]
|
two_orgs = organizations(2)
|
||||||
the_project = resourced_organization.projects.all()[0]
|
organization = two_orgs[0]
|
||||||
organization2.projects.add(the_project)
|
other_org = two_orgs[1]
|
||||||
organization2.projects.create(name="second-project",
|
|
||||||
description="test-proj-desc",
|
unrelated_inv = other_org.inventories.create(name='not-in-organization')
|
||||||
scm_type="git",
|
project.jobtemplates.create(name="test-jt",
|
||||||
scm_url="https://github.com/jlaska/ansible-playbooks")
|
description="test-job-template-desc",
|
||||||
inventory = organization2.inventories.create(name="second-inventory")
|
inventory=unrelated_inv,
|
||||||
organization2.projects.get(name="second-project").jobtemplates.create(
|
playbook="test_playbook.yml")
|
||||||
name="second-job-template",
|
organization.projects.add(project)
|
||||||
inventory=inventory,
|
|
||||||
playbook="hello.yml"
|
|
||||||
)
|
|
||||||
|
|
||||||
response = get(reverse('api:organization_list', args=[]), external_admin)
|
response = get(reverse('api:organization_list', args=[]), external_admin)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
org_id_full = resourced_organization.id
|
org_id = organization.id
|
||||||
org_id2 = organization2.id
|
|
||||||
counts = {}
|
counts = {}
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
org_id = response.data['results'][i]['id']
|
working_id = response.data['results'][i]['id']
|
||||||
counts[org_id] = response.data['results'][i]['summary_fields']['related_field_counts']
|
counts[working_id] = response.data['results'][i]['summary_fields']['related_field_counts']
|
||||||
|
|
||||||
assert counts[org_id_full] == {
|
assert counts[org_id] == {
|
||||||
'users': 1,
|
|
||||||
'admins': 1,
|
|
||||||
'job_templates': 1,
|
|
||||||
'projects': 1,
|
|
||||||
'inventories': 1,
|
|
||||||
'teams': 1
|
|
||||||
}
|
|
||||||
assert counts[org_id2] == {
|
|
||||||
'users': 0,
|
'users': 0,
|
||||||
'admins': 0,
|
'admins': 0,
|
||||||
'job_templates': 2,
|
'job_templates': 1,
|
||||||
'projects': 2,
|
'projects': 1,
|
||||||
'inventories': 1,
|
'inventories': 0,
|
||||||
'teams': 0
|
'teams': 0
|
||||||
}
|
}
|
||||||
assert False
|
|
||||||
|
Loading…
Reference in New Issue
Block a user