Example #1
0
def test_get_job():
    job = Job.create(session, 'foo', 'bar', 'baz')
    job.state = 'ok'
    job.last_stamp = job.last_seen = datetime(1979, 7, 9)
    session.flush()

    result = JobResult.create(job=job, clock_ms=117,
                              result={}, rusage={}, output='Hello, World!')
    session.flush()

    client = Client(app, BaseResponse)
    resp = client.get('/job/%d/' % job.id)
    assert resp.status_code == 200
    assert 'Hello, World!' in resp.data
Example #2
0
def test_get_job_exit():
    job = get_job(session, state='error')
    inner_result = {
        'ok': False,
        'reason': 'exit',
        'code': 2,
    }
    r = JobResult.create(
        job=job, clock_ms=118, result=inner_result, rusage={},
        output='Foo, Bir!')
    r.state = 'error'
    session.flush()

    client = Client(app, BaseResponse)
    resp = client.get('/job/%d/' % job.id)
    assert resp.status_code == 200
    assert 'Foo, Bir!' in resp.data
    assert 'exit(2)' in resp.data
Example #3
0
def test_get_job_ok():
    job = get_job(session)
    JobResult.create(
        job=job, clock_ms=117, result={'ok': True}, rusage={},
        output='Hello, World!')