コード例 #1
0
    def _get_request_view_and_content(self, rf, create_content=True):
        request = rf.get("/")
        request.user = UserFactory()
        profile = request.user.profile
        profile.visibility = Visibility.PUBLIC
        profile.save()

        contents = []
        if create_content:
            contents.extend([
                ContentFactory(author=profile, order=3, pinned=True),
                ContentFactory(author=profile, order=2, pinned=True),
                ContentFactory(author=profile, order=1, pinned=True),
            ])
        view = OrganizeContentProfileDetailView(request=request)
        view.object = profile
        view.target_profile = profile
        return request, view, contents, profile
コード例 #2
0
    def _get_request_view_and_content(self, create_content=True):
        request = RequestFactory().get("/")
        request.user = self.user
        profile = self.user.profile

        contents = []
        if create_content:
            contents.extend([
                ContentFactory(author=profile, order=3, pinned=True),
                ContentFactory(author=profile, order=2, pinned=True),
                ContentFactory(author=profile, order=1, pinned=True),
            ])
            Content.objects.filter(id=contents[0].id).update(order=3)
            Content.objects.filter(id=contents[1].id).update(order=2)
            Content.objects.filter(id=contents[2].id).update(order=1)
        view = OrganizeContentProfileDetailView(request=request)
        view.profile = profile
        view.kwargs = {"uuid": profile.uuid}
        return request, view, contents, profile
コード例 #3
0
ファイル: test_views.py プロジェクト: jaywink/socialhome
    def _get_request_view_and_content(self, create_content=True):
        request = RequestFactory().get("/")
        request.user = self.user
        profile = self.user.profile

        contents = []
        if create_content:
            contents.extend([
                ContentFactory(author=profile, order=3, pinned=True),
                ContentFactory(author=profile, order=2, pinned=True),
                ContentFactory(author=profile, order=1, pinned=True),
            ])
            Content.objects.filter(id=contents[0].id).update(order=3)
            Content.objects.filter(id=contents[1].id).update(order=2)
            Content.objects.filter(id=contents[2].id).update(order=1)
        view = OrganizeContentProfileDetailView(request=request)
        view.profile = profile
        view.kwargs = {"uuid": profile.uuid}
        return request, view, contents, profile
コード例 #4
0
    def _get_request_view_and_content(self, rf, create_content=True):
        request = rf.get("/")
        request.user = UserFactory()
        profile = request.user.profile
        profile.visibility = Visibility.PUBLIC
        profile.save()

        contents = []
        if create_content:
            contents.extend([
                ContentFactory(author=profile, order=3, pinned=True),
                ContentFactory(author=profile, order=2, pinned=True),
                ContentFactory(author=profile, order=1, pinned=True),
            ])
            Content.objects.filter(id=contents[0].id).update(order=3)
            Content.objects.filter(id=contents[1].id).update(order=2)
            Content.objects.filter(id=contents[2].id).update(order=1)
        view = OrganizeContentProfileDetailView(request=request)
        view.object = profile
        view.target_profile = profile
        view.kwargs = {"guid": profile.guid}
        return request, view, contents, profile