Commit 1e1e517a authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

better nomenclature for task scheduling

new_job -> schedule-task
parent a2699a6f736d
......@@ -92,8 +92,9 @@ def reworkui(engine,
serviceactions=None,
alttemplate=None):
@bp.route('/new_job/<service>', methods=['PUT'])
def submit_job(service):
@bp.route('/schedule-task/<service>', methods=['PUT'])
@bp.route('/new_job/<service>', methods=['PUT']) # bw compat
def schedule_task(service):
args = argsdict()
args.update(argsdict(request.form))
args.update(argsdict(request.args))
......
......@@ -45,7 +45,7 @@ function refresh_section(section) {
function start_job(operation, form) {
fetch(`new_job/${operation}?user=WEBUI`,
fetch(`schedule-task/${operation}?user=WEBUI`,
{method: 'PUT', body: new FormData(form), credentials: 'same-origin'})
refresh_section('services')
}
......
......@@ -55,28 +55,28 @@ def test_no_job(client):
def test_bad_request(engine, client):
# bad hostid
res = client.put('/new_job/good_job?user={}&hostid={}'.format('Babar', 'fancyhost'),
res = client.put('/schedule-task/good_job?user={}&hostid={}'.format('Babar', 'fancyhost'),
upload_files=[('input_file', 'input.xml', b'the file', 'text/xml')]
)
assert res.status == '400 BAD REQUEST'
assert b'No operation was found' in res.body
# bad operation
res = client.put('/new_job/fake_job?user={}'.format('Babar'),
res = client.put('/schedule-task/fake_job?user={}'.format('Babar'),
upload_files=[('input_file', 'input.xml', b'the file', 'text/xml')]
)
assert res.status == '400 BAD REQUEST'
assert b'No operation was found' in res.body
# bad operation
res = client.put('/new_job/good_job?user={}'.format('Babar'))
res = client.put('/schedule-task/good_job?user={}'.format('Babar'))
assert res.status == '400 BAD REQUEST'
assert b'input file is mandatory' in res.body
def test_abort(engine, client):
with workers(engine) as mon:
res = client.put('/new_job/abortme?user=Babar',
res = client.put('/schedule-task/abortme?user=Babar',
upload_files=[('input_file', 'input.xml', b'the file', 'text/xml')])
tid = int(res.body)
t = Task.byid(engine, tid)
......@@ -90,7 +90,7 @@ def test_task_life_cycle(engine, client, refresh):
with workers(engine):
tasks = []
for user in ('Babar', 'Babar', 'Celeste'):
res = client.put('/new_job/good_job?user={}'.format(user),
res = client.put('/schedule-task/good_job?user={}'.format(user),
upload_files=[('input_file', 'input.xml', b'the file', 'text/xml')]
)
tid = int(res.body)
......@@ -105,7 +105,7 @@ def test_task_life_cycle(engine, client, refresh):
tasks.append(t1)
res = client.put('/new_job/bad_job?user=Celeste',
res = client.put('/schedule-task/bad_job?user=Celeste',
upload_files=[('input_file', 'input.xml', b'the file', 'text/xml')]
)
tid = int(res.body)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment