示例#1
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)
示例#2
0
 def test_delete_should_return_json_string_of_job_posting(
         self, mock_delete, mock_session):
     mock_delete.return_value = self.test_job_posting
     result, code, header = JobPostingHandler.delete(
         self.test_job_posting.id)
     self.assertEqual(
         self.test_job_posting,
         json.loads(result, object_hook=lambda d: JobPosting(**d)))
     mock_delete.assert_called_once_with(mock.ANY, self.test_job_posting.id)
     self.assertEqual(200, code)
     self.assertEqual({'Content-Type': 'application/json'}, header)
示例#3
0
 def test_delete_should_throw_400_error_if_job_posting_id_is_null(self):
     with self.assertRaises(HTTPException) as ex:
         JobPostingHandler.delete(None)
     self.assertEqual(ex.exception.code, 400)
示例#4
0
文件: main.py 项目: glucn/tofino
def delete(job_posting_id):
    return JobPostingHandler.delete(job_posting_id)