summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awx/api/views/__init__.py1
-rw-r--r--awx/main/tests/functional/api/test_job.py10
2 files changed, 10 insertions, 1 deletions
diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py
index b48ff17345..5fdc0e29d7 100644
--- a/awx/api/views/__init__.py
+++ b/awx/api/views/__init__.py
@@ -3333,7 +3333,6 @@ class JobLabelList(SubListAPIView):
serializer_class = serializers.LabelSerializer
parent_model = models.Job
relationship = 'labels'
- parent_key = 'job'
class WorkflowJobLabelList(JobLabelList):
diff --git a/awx/main/tests/functional/api/test_job.py b/awx/main/tests/functional/api/test_job.py
index 53e31e5981..836f94da0c 100644
--- a/awx/main/tests/functional/api/test_job.py
+++ b/awx/main/tests/functional/api/test_job.py
@@ -52,6 +52,16 @@ def test_job_relaunch_permission_denied_response(post, get, inventory, project,
@pytest.mark.django_db
+def test_label_sublist(get, admin_user, organization):
+ job = Job.objects.create()
+ label = Label.objects.create(organization=organization, name='Steve')
+ job.labels.add(label)
+ r = get(url=reverse('api:job_label_list', kwargs={'pk': job.pk}), user=admin_user, expect=200)
+ assert r.data['count'] == 1
+ assert r.data['results'].pop()['id'] == label.id
+
+
+@pytest.mark.django_db
def test_job_relaunch_prompts_not_accepted_response(post, get, inventory, project, credential, net_credential, machine_credential):
jt = JobTemplate.objects.create(name='testjt', inventory=inventory, project=project)
jt.credentials.add(machine_credential)