예제 #1
0
    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()
예제 #2
0
    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()
예제 #3
0
    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)
예제 #4
0
    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)