示例#1
0
  def test_DeletePostWhenPostDAOThrows(self):
    postDAO = PostDAO(None)
    postDAO.delete = MagicMock(side_effect=UnknownElementException())
    postController = PostController(postDAO)
    request = Request(None)
    deleteId = 3

    response = postController.deletePost(deleteId, request)

    self.assertEqual(404, response.status_code)
    postDAO.delete.assert_called_with(deleteId)
示例#2
0
  def test_DeletePost(self):
    postDAO = PostDAO(None)
    postDAO.delete = MagicMock()
    postController = PostController(postDAO)
    request = Request(None)
    deleteId = "3"

    response = postController.deletePost(deleteId, request)

    self.assertEqual(204, response.status_code)
    postDAO.delete.assert_called_with(deleteId)