コード例 #1
0
ファイル: test_views.py プロジェクト: riddhi89/mercury-api
 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
ファイル: test_views.py プロジェクト: riddhi89/mercury-api
 def test_get_one_error(self):
     with mercury_app.test_request_context():
         self.view.get(mercury_id='does-not-exist')
コード例 #3
0
ファイル: test_views.py プロジェクト: riddhi89/mercury-api
 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