Commit c24759f4 authored by Joao Pedro Lopes's avatar Joao Pedro Lopes
Browse files

Ajust test_job_listing.py to validate file_metadata as a JSON object:

 - After commit 646c8d11 the Job parameter file_metadata is enforced to be a JSON object. Tests have to be changed accordingly.
parent 2ea88472
Pipeline #3012671 failed with stage
in 9 seconds
......@@ -520,21 +520,23 @@ class TestJobListing(TestController):
self.push_delegation()
job1 = self._submit(file_metadata='a')
job2 = self._submit(file_metadata='5')
job2 = self._submit(file_metadata={'key': 'value'})
job3 = self._submit(file_metadata='?')
job4 = self._submit(file_metadata={'key': 5})
jobs = self.app.get(
url="/jobs/%s?files=job_id,file_metadata" % ','.join([job1, job2, job3]),
url="/jobs/%s?files=job_id,file_metadata" % ','.join([job1, job2, job3, job4]),
status=200).json
self.assertEqual(3, len(jobs))
self.assertEqual(4, len(jobs))
self.assertEqual(jobs[0]['job_id'], jobs[0]['files'][0]['job_id'])
self.assertEqual('a', jobs[0]['files'][0]['file_metadata'])
self.assertEqual({'label': 'a'}, jobs[0]['files'][0]['file_metadata'])
self.assertEqual(jobs[1]['job_id'], jobs[1]['files'][0]['job_id'])
self.assertEqual('5', jobs[1]['files'][0]['file_metadata'])
self.assertEqual({"key": "value"}, jobs[1]['files'][0]['file_metadata'])
self.assertEqual(jobs[2]['job_id'], jobs[2]['files'][0]['job_id'])
self.assertEqual('?', jobs[2]['files'][0]['file_metadata'])
self.assertEqual({'label': '?'}, jobs[2]['files'][0]['file_metadata'])
self.assertEqual(jobs[3]['job_id'], jobs[3]['files'][0]['job_id'])
self.assertEqual({'key': 5}, jobs[3]['files'][0]['file_metadata'])
def test_query_something_running(self):
"""
Query if there are any active or submitted files for a given destination surl
......
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