def test_post(self): data = {'query': {}} with mercury_app.test_request_context(data=json.dumps(data), method='POST', content_type='application/json'): response = self.view.post() data = json.loads(response.data) assert data['count'] == 1
def test_get_one_error(self): with mercury_app.test_request_context(): self.view.get(mercury_id='does-not-exist')
def test_get_one(self): with mercury_app.test_request_context(): response = self.view.get(test_mercury_id) data = json.loads(response.data) assert data['mercury_id'] == test_mercury_id
def test_get_one_error(self): with mercury_app.test_request_context(): self.view.get(job_id='does-not-have-tasks')
def test_post_query_error(self): data = {'instruction': {}, 'query': {'some-silly-query': 123}} with mercury_app.test_request_context(data=json.dumps(data), method='POST', content_type='application/json'): self.view.post()
def test_get(self): with mercury_app.test_request_context(): response = self.view.get() data = json.loads(response.data) assert data['items'][0]['job_id'] == test_job_id