---
- name: Launch a Job Template
  tower_job_launch:
    job_template: "Demo Job Template"
  register: job

- assert:
    that:
      - "job is changed"
      - "job.status == 'pending'"

- name: List jobs w/ a matching primary key
  tower_job_list:
    query: {"id": "{{ job.id }}"}
  register: matching_jobs

- assert:
    that:
      - "{{ matching_jobs.count }} == 1"

- name: List failed jobs (which don't exist)
  tower_job_list:
    status: failed
    query: {"id": "{{ job.id }}"}
  register: successful_jobs

- assert:
    that:
      - "{{ successful_jobs.count }} == 0"

- name: Get ALL result pages!
  tower_job_list:
    all_pages: true
  register: all_page_query

- assert:
    that:
      - 'not all_page_query.next'
