Пример #1
0
 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
Пример #2
0
 def test_get_one_error(self):
     with mercury_app.test_request_context():
         self.view.get(mercury_id='does-not-exist')
Пример #3
0
 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
Пример #4
0
 def test_get_one_error(self):
     with mercury_app.test_request_context():
         self.view.get(job_id='does-not-have-tasks')
Пример #5
0
 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()
Пример #6
0
 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