Ejemplo n.º 1
0
    def setUp(self):
        StubActionDataProvider.clear()
        StubFollowDataProvider.clear()
        StubUserDataProvider.clear()

        self.controller = UserController.from_settings()
        self.controller.create_user(username='******')
        self.controller.create_user(username='******')
Ejemplo n.º 2
0
class UserListAPIView(DemoAPIView):

    controller = UserController.from_settings()

    def do_get(self, request):
        users = self.controller.user_dp.list()
        data = UserSerializer(users, many=True).data
        return DemoResponse(data)

    def do_post(self, request):
        username = request.arguments['username']
        user = self.controller.create_user(username=username)
        return DemoResponse(UserSerializer(user).data)

    def get_arguments_serializer_class(self, request):
        if request.method == 'POST':
            return UserSerializer
        return None
Ejemplo n.º 3
0
class BaseFollowAPIView(DemoAPIView):
    controller = UserController.from_settings()