def _get_request_view_and_content(self, create_content=True, anonymous_user=False): request = self.client.get("/") request.site = get_current_site(request) if anonymous_user: request.user = AnonymousUser() profile = self.profile else: 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 = ProfileDetailView(request=request, kwargs={"guid": profile.guid}) view.object = profile view.target_profile = profile return request, view, contents, profile
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 = ProfileDetailView(request=request, kwargs={"guid": profile.guid}) view.object = profile view.target_profile = profile return request, view, contents, profile
def _get_request_view_and_content(self, create_content=True): request = self.client.get("/") request.user = self.user 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 = ProfileDetailView(request=request, kwargs={"guid": profile.guid}) view.object = profile view.target_profile = profile return request, view, contents, profile
def _get_request_view_and_content(self, create_content=True, anonymous_user=False): request = self.client.get("/") if anonymous_user: request.user = AnonymousUser() profile = self.profile else: 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 = ProfileDetailView(request=request, kwargs={"uuid": profile.uuid}) view.object = profile view.set_object_and_data() return request, view, contents, profile