def test_update_user_not_found(self): request = pyramid_testing.DummyRequest() request.db_session = None request.json_body = {"id": "1", "first_name": "Ben", "last_name": "Franklin", "email": "*****@*****.**"} user_service = UserServiceRest(None, request, dao=Mock) user_service._dao.update = Mock(side_effect=PersistenceError()) with self.assertRaises(HTTPNotFound): user_service.update_user()
def test_update_user_success(self): request = pyramid_testing.DummyRequest() request.db_session = None request.json_body = {"id": "1", "first_name": "Ben", "last_name": "Franklin", "email": "*****@*****.**"} user_service = UserServiceRest(None, request, dao=Mock) response = user_service.update_user() self.assertEqual(202, response.status_int)