示例#1
0
 def test_get_should_throw_404_error_if_job_posting_does_not_exist(
         self, mock_get, mock_session):
     mock_get.return_value = None
     with self.assertRaises(HTTPException) as ex:
         JobPostingHandler.get(self.test_job_posting.id)
     self.assertEqual(ex.exception.code, 404)
     mock_get.assert_called_once_with(mock.ANY, self.test_job_posting.id)
示例#2
0
 def test_delete_should_throw_500_error_if_deleting_fails(
         self, mock_delete, mock_session):
     mock_delete.return_value = None
     with self.assertRaises(HTTPException) as ex:
         JobPostingHandler.delete(self.test_job_posting.id)
     self.assertEqual(ex.exception.code, 500)
     mock_delete.assert_called_once_with(mock.ANY, self.test_job_posting.id)
示例#3
0
 def test_get_should_return_json_string_of_job_posting(
         self, mock_get, mock_session):
     mock_get.return_value = self.test_job_posting
     result, code, header = JobPostingHandler.get(self.test_job_posting.id)
     self.assertEqual(
         self.test_job_posting,
         json.loads(result, object_hook=lambda d: JobPosting(**d)))
     mock_get.assert_called_once_with(mock.ANY, self.test_job_posting.id)
     self.assertEqual(200, code)
     self.assertEqual({'Content-Type': 'application/json'}, header)
示例#4
0
 def test_update_should_throw_400_error_if_job_posting_id_is_null(self):
     with self.assertRaises(HTTPException) as ex:
         JobPostingHandler.update(None)
     self.assertEqual(ex.exception.code, 400)
示例#5
0
文件: main.py 项目: glucn/tofino
def delete(job_posting_id):
    return JobPostingHandler.delete(job_posting_id)
示例#6
0
文件: main.py 项目: glucn/tofino
def update(job_posting_id):
    return JobPostingHandler.update(job_posting_id, **request.get_json())
示例#7
0
文件: main.py 项目: glucn/tofino
def create():
    return JobPostingHandler.create(**request.get_json())
示例#8
0
文件: main.py 项目: glucn/tofino
def get(job_posting_id):
    return JobPostingHandler.get(job_posting_id)