"Test results page"
def test_results_with_stderr_output(
        client, job_id, stderr_with_output, # pylint: disable=[unused-argument]
        redis_conn_with_in_progress_job_no_errors): # pylint: disable=[unused-argument]
    """
    GIVEN: 1. A flask application testing client
           2. A file with content to simulate the stderr output
           3. A sample job to prevent the "No such job" error message
    WHEN: The parsing progress page is loaded for a non existing job
    THEN: Ensure that the page:
          1. Redirects to a job failure display page
          2. The job failure display page:
             a) indicates that this is a worker failure
             b) provides some debugging information
    """
    # Maybe get rid of the use of a stderr file, and check for actual exceptions
    resp = client.get(f"/parse/status/{job_id}", follow_redirects=True)
    assert len(resp.history) == 1
    assert b'
Worker Failure
' in resp.data
    assert b'Debugging Information
' in resp.data
    assert (
        f"job id: {job_id}".encode("utf8")
        in resp.data)
def test_results_with_completed_job_no_errors(
        client, job_id, stderr_with_no_output, # pylint: disable=[unused-argument]
        redis_conn_with_completed_job_no_errors): # pylint: disable=[unused-argument]
    """
    GIVEN: 1. A flask application testing client
           2. A redis instance with a completed job, with no errors found in
              the file
           3. A file with no contents to simulate no stderr output
    WHEN: The parsing progress page is loaded
    THEN: Ensure that:
          1. the system redirects to the results page
          2. the results page indicates that there are no errors in the file
             being processed
    """
    resp = client.get(f"/parse/status/{job_id}", follow_redirects=True)
    assert len(resp.history) == 1
    assert (
        b'No errors found in the file'
        in resp.data)
def test_results_with_completed_job_some_errors(
        client, job_id, stderr_with_no_output, # pylint: disable=[unused-argument]
        redis_conn_with_completed_job_some_errors): # pylint: disable=[unused-argument]
    """
    GIVEN: 1. A flask application testing client
           2. A redis instance with a completed job, with some errors found in
              the file
           3. A file with no contents to simulate no stderr output
    WHEN: The parsing progress page is loaded
    THEN: Ensure that:
          1. the system redirects to the results page
          2. the results page displays the errors found
    """
    resp = client.get(f"/parse/status/{job_id}", follow_redirects=True)
    assert len(resp.history) == 1
    assert (
        b'We found the following errors
'
        in resp.data)
    assert b'' in resp.data
    assert b'Duplicate Header' in resp.data
    assert b'| Heading 'DupHead' is repeated' in resp.data
    assert b'Invalid Value' in resp.data
    assert b' | Invalid value 'ohMy'' in resp.data |