예제 #1
0
    def setUp(self):
        self.profile = ProfileFactory()
        self.other = ProfileFactory()
        self.new_participant = ProfileFactory()
        self.client = APIClient()
        client_oauth2 = create_oauth2_client(self.profile.user)
        authenticate_client(self.client, client_oauth2,
                            self.profile.user.username, "hostel77")

        self.gallery = GalleryFactory()
        UserGalleryFactory(user=self.profile.user, gallery=self.gallery)
        self.image = ImageFactory(gallery=self.gallery)

        self.gallery_other = GalleryFactory()
        UserGalleryFactory(user=self.other.user, gallery=self.gallery_other)
        self.image_other = ImageFactory(gallery=self.gallery_other)

        self.gallery_shared = GalleryFactory()
        UserGalleryFactory(user=self.other.user, gallery=self.gallery_shared)
        UserGalleryFactory(user=self.profile.user,
                           gallery=self.gallery_shared,
                           mode=GALLERY_READ)
        self.image_shared = ImageFactory(gallery=self.gallery_shared)

        tuto = PublishableContentFactory(
            type="TUTORIAL",
            author_list=[self.profile.user, self.new_participant.user])
        self.gallery_tuto = tuto.gallery
예제 #2
0
    def setUp(self):
        settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
        self.mas = ProfileFactory().user
        self.overridden_zds_app["member"]["bot_account"] = self.mas.username

        self.licence = LicenceFactory()

        self.user_author = ProfileFactory().user
        self.staff = StaffProfileFactory().user

        self.tuto = PublishableContentFactory(type="TUTORIAL")
        self.tuto.authors.add(self.user_author)
        UserGalleryFactory(gallery=self.tuto.gallery,
                           user=self.user_author,
                           mode="W")
        self.tuto.licence = self.licence
        self.tuto.save()

        self.tuto_draft = self.tuto.load_version()
        self.part1 = ContainerFactory(parent=self.tuto_draft,
                                      db_object=self.tuto)
        self.chapter1 = ContainerFactory(parent=self.part1,
                                         db_object=self.tuto)

        self.extract1 = ExtractFactory(container=self.chapter1,
                                       db_object=self.tuto)
예제 #3
0
    def setUp(self):
        self.user1 = ProfileFactory().user
        self.user1.profile.email_for_answer = True
        self.user1.profile.email_for_new_mp = False
        self.user1.profile.save()

        self.user2 = ProfileFactory().user
        self.user2.profile.email_for_answer = True
        self.user2.profile.email_for_new_mp = False
        self.user2.profile.save()

        self.user3 = ProfileFactory().user
        self.user3.profile.email_for_answer = True
        self.user3.profile.email_for_new_mp = True
        self.user3.profile.save()

        self.user4 = ProfileFactory().user
        self.user4.profile.email_for_answer = False
        self.user4.profile.email_for_new_mp = False
        self.user4.profile.save()

        self.user5 = ProfileFactory().user
        self.user5.profile.email_for_answer = False
        self.user5.profile.email_for_new_mp = True
        self.user5.profile.save()

        # Login as profile1
        self.client.force_login(self.user1)

        # Save bot group
        bot = Group(name=settings.ZDS_APP["member"]["bot_group"])
        bot.save()
class SetLastVisitMiddlewareTest(TestCase):
    def setUp(self):
        self.user = ProfileFactory()

    def test_process_response(self):
        profile_pk = self.user.pk

        # login
        self.client.force_login(self.user.user)

        # set last login to a recent date
        self.user.last_visit = datetime.now() - timedelta(seconds=10)
        self.user.save()

        # load a page
        self.client.get(reverse("homepage"))

        # the date of last visit should not have been updated
        profile = get_object_or_404(Profile, pk=profile_pk)
        self.assertTrue(
            datetime.now() - profile.last_visit > timedelta(seconds=5))

        # set last login to an old date
        self.user.last_visit = datetime.now() - timedelta(seconds=45)
        self.user.save()

        # load a page
        self.client.get(reverse("homepage"))

        # the date of last visit should have been updated
        profile = get_object_or_404(Profile, pk=profile_pk)
        self.assertTrue(
            datetime.now() - profile.last_visit < timedelta(seconds=5))
예제 #5
0
    def test_remove_hat(self):
        hat_name = "A hat"

        profile = ProfileFactory()
        user = profile.user
        # add a hat with a staff member
        self.client.force_login(self.staff)
        self.client.post(reverse("add-hat", args=[user.pk]), {"hat": hat_name},
                         follow=False)
        self.assertIn(hat_name, profile.hats.values_list("name", flat=True))
        hat = Hat.objects.get(name=hat_name)
        # test that this option is not available for an other user
        self.client.force_login(ProfileFactory().user)
        result = self.client.post(reverse("remove-hat", args=[user.pk,
                                                              hat.pk]),
                                  follow=False)
        self.assertEqual(result.status_code, 403)
        self.assertIn(hat, profile.hats.all())
        # but check that it works for the user having the hat
        self.client.force_login(user)
        result = self.client.post(reverse("remove-hat", args=[user.pk,
                                                              hat.pk]),
                                  follow=False)
        self.assertEqual(result.status_code, 302)
        self.assertNotIn(hat, profile.hats.all())
        # test that it works for a staff member
        profile.hats.add(hat)  # we have to add the hat again for this test
        self.client.force_login(self.staff)
        result = self.client.post(reverse("remove-hat", args=[user.pk,
                                                              hat.pk]),
                                  follow=False)
        self.assertEqual(result.status_code, 302)
        self.assertNotIn(hat, profile.hats.all())
        # but check that the hat still exists in database
        self.assertTrue(Hat.objects.filter(name=hat_name).exists())
예제 #6
0
    def setUp(self):
        # Create users
        self.author = ProfileFactory().user
        self.staff = StaffProfileFactory().user
        self.outsider = ProfileFactory().user
        self.contributor = ProfileFactory().user

        # Create a contribution role
        self.role = create_role("Validateur")

        # Create content
        self.content = PublishableContentFactory(author_list=[self.author])
        self.contribution = create_contribution(self.role, self.contributor,
                                                self.content)

        # Get information to be reused in tests
        self.form_url = reverse("content:remove-contributor",
                                kwargs={"pk": self.content.pk})
        self.login_url = reverse("member-login") + "?next=" + self.form_url
        self.content_url = reverse("content:view",
                                   kwargs={
                                       "pk": self.content.pk,
                                       "slug": self.content.slug
                                   })
        self.form_data = {"pk_contribution": self.contribution.pk}
예제 #7
0
    def setUp(self):
        self.overridden_zds_app = overridden_zds_app
        # don't build PDF to speed up the tests
        overridden_zds_app["content"]["build_pdf_when_published"] = False

        self.staff = StaffProfileFactory().user

        settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
        self.mas = ProfileFactory().user
        overridden_zds_app["member"]["bot_account"] = self.mas.username

        self.licence = LicenceFactory()
        self.subcategory = SubCategoryFactory(category=CategoryFactory())

        self.user_author = ProfileFactory().user
        self.user_staff = StaffProfileFactory().user
        self.user_guest = ProfileFactory().user
        self.content = PublishableContentFactory(
            author_list=[self.user_author], light=False)
        self.part_published = ContainerFactory(
            db_object=self.content,
            light=False,
            parent=self.content.load_version())
        self.ignored_part = ContainerFactory(
            db_object=self.content,
            light=False,
            parent=self.content.load_version())
        ExtractFactory(db_object=self.content,
                       container=self.part_published,
                       light=False)
        ExtractFactory(db_object=self.content,
                       container=self.ignored_part,
                       light=False)
예제 #8
0
 def setUp(self):
     self.gallery = GalleryFactory()
     self.profile1 = ProfileFactory()
     self.profile2 = ProfileFactory()
     self.profile3 = ProfileFactory()
     self.user_gallery1 = UserGalleryFactory(user=self.profile1.user, gallery=self.gallery, mode="W")
     self.user_gallery2 = UserGalleryFactory(user=self.profile2.user, gallery=self.gallery, mode="R")
예제 #9
0
    def test_profile_page_of_weird_member_username(self):

        # create some user with weird username
        user_1 = ProfileFactory()
        user_2 = ProfileFactory()
        user_3 = ProfileFactory()
        user_1.user.username = "******"
        user_1.user.save()
        user_2.user.username = "******"
        user_2.user.save()
        user_3.user.username = "******"
        user_3.user.save()

        # profile pages of weird users.
        result = self.client.get(reverse("member-detail",
                                         args=[user_1.user.username]),
                                 follow=True)
        self.assertEqual(result.status_code, 200)
        result = self.client.get(reverse("member-detail",
                                         args=[user_2.user.username]),
                                 follow=True)
        self.assertEqual(result.status_code, 200)
        result = self.client.get(reverse("member-detail",
                                         args=[user_3.user.username]),
                                 follow=True)
        self.assertEqual(result.status_code, 200)
예제 #10
0
 def test_hat_request_detail(self):
     hat_name = "A hat"
     # ask for a hat
     profile = ProfileFactory()
     self.client.force_login(profile.user)
     result = self.client.post(
         reverse("hats-settings"),
         {
             "hat": hat_name,
             "reason": "test",
         },
         follow=False,
     )
     self.assertEqual(result.status_code, 302)
     request = HatRequest.objects.latest("date")
     # test this page is available for the request author
     result = self.client.get(request.get_absolute_url())
     self.assertEqual(result.status_code, 200)
     # test it's not available for another user
     other_user = ProfileFactory().user
     self.client.force_login(other_user)
     result = self.client.get(request.get_absolute_url())
     self.assertEqual(result.status_code, 403)
     # login as staff
     self.client.force_login(self.staff)
     # test the page works
     result = self.client.get(request.get_absolute_url())
     self.assertEqual(result.status_code, 200)
     self.assertContains(result, hat_name)
     self.assertContains(result, profile.user.username)
     self.assertContains(result, request.reason)
    def setUp(self):
        # Create users
        self.author = ProfileFactory().user
        self.staff = StaffProfileFactory().user
        self.outsider = ProfileFactory().user
        self.contributor = ProfileFactory().user
        settings.ZDS_APP["member"]["bot_account"] = ProfileFactory(
        ).user.username

        # Create content
        self.content = PublishableContentFactory(author_list=[self.author])
        self.role = create_role("Contributeur espiègle")

        # Get information to be reused in tests
        self.form_url = reverse("content:add-contributor",
                                kwargs={"pk": self.content.pk})
        self.login_url = reverse("member-login") + "?next=" + self.form_url
        self.content_url = reverse("content:view",
                                   kwargs={
                                       "pk": self.content.pk,
                                       "slug": self.content.slug
                                   })
        self.form_data = {
            "username": self.contributor,
            "contribution_role": self.role.pk
        }
예제 #12
0
    def setUp(self):
        self.user1 = ProfileFactory().user
        self.user2 = ProfileFactory().user

        # create a tutorial
        self.tuto = PublishableContentFactory(type="TUTORIAL")
        self.tuto.authors.add(self.user1)
        UserGalleryFactory(gallery=self.tuto.gallery,
                           user=self.user1,
                           mode="W")
        self.tuto.licence = LicenceFactory()
        self.tuto.subcategory.add(SubCategoryFactory())
        self.tuto.save()
        tuto_draft = self.tuto.load_version()

        # then, publish it !
        version = tuto_draft.current_version
        self.published = publish_content(self.tuto,
                                         tuto_draft,
                                         is_major_update=True)

        self.tuto.sha_public = version
        self.tuto.sha_draft = version
        self.tuto.public_version = self.published
        self.tuto.save()

        self.client.force_login(self.user1)
예제 #13
0
    def test_subscription_deactivated_and_notification_read_when_topic_moved(self):
        """
        When a topic is moved to a forum where subscribers can't read it, the subscriptions
        should be deactivated and notifications marked as read.
        """
        topic = TopicFactory(forum=self.forum11, author=self.user1)
        PostFactory(topic=topic, author=self.user1, position=1)
        other_user = ProfileFactory().user
        TopicAnswerSubscription.objects.toggle_follow(topic, other_user)
        PostFactory(topic=topic, author=ProfileFactory().user, position=2)

        self.assertIsNotNone(TopicAnswerSubscription.objects.get_existing(self.user1, topic, is_active=True))
        self.assertIsNotNone(Notification.objects.get(subscription__user=self.user1, is_read=False))

        forum_not_read = ForumFactory(category=self.category1, position_in_category=2)
        forum_not_read.groups.add(Group.objects.create(name="DummyGroup_1"))

        self.client.force_login(StaffProfileFactory().user)
        data = {"move": "", "forum": forum_not_read.pk, "topic": topic.pk}
        response = self.client.post(reverse("topic-edit"), data, follow=False)

        self.assertEqual(302, response.status_code)
        self.assertIsNotNone(TopicAnswerSubscription.objects.get_existing(self.user1, topic, is_active=False))
        self.assertIsNotNone(Notification.objects.get(subscription__user=self.user1, is_read=True))
        self.assertFalse(TopicAnswerSubscription.objects.get_existing(other_user, topic).is_active)
        self.assertIsNotNone(Notification.objects.get(subscription__user=other_user, is_read=True))
예제 #14
0
    def setUp(self):
        self.overridden_zds_app = overridden_zds_app
        # don't build PDF to speed up the tests
        overridden_zds_app["content"]["build_pdf_when_published"] = False

        self.staff = StaffProfileFactory().user

        settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
        self.mas = ProfileFactory().user
        overridden_zds_app["member"]["bot_account"] = self.mas.username

        bot = Group(name=overridden_zds_app["member"]["bot_group"])
        bot.save()
        self.external = UserFactory(
            username=overridden_zds_app["member"]["external_account"],
            password="******")

        self.beta_forum = ForumFactory(
            pk=overridden_zds_app["forum"]["beta_forum_id"],
            category=ForumCategoryFactory(position=1),
            position_in_category=1,
        )  # ensure that the forum, for the beta versions, is created

        self.licence = LicenceFactory()
        self.subcategory = SubCategoryFactory()
        self.tag = TagFactory()

        self.user_author = ProfileFactory().user
        self.user_staff = StaffProfileFactory().user
        self.user_guest = ProfileFactory().user

        # create an article
        self.article = PublishableContentFactory(type="ARTICLE")
        self.article.authors.add(self.user_author)
        UserGalleryFactory(gallery=self.article.gallery,
                           user=self.user_author,
                           mode="W")
        self.article.licence = self.licence
        self.article.subcategory.add(self.subcategory)
        self.article.tags.add(self.tag)
        self.article.save()

        # fill it with one extract
        self.article_draft = self.article.load_version()
        self.extract1 = ExtractFactory(container=self.article_draft,
                                       db_object=self.article)

        # then, publish it !
        version = self.article_draft.current_version
        self.published = publish_content(self.article,
                                         self.article_draft,
                                         is_major_update=True)

        self.article.sha_public = version
        self.article.sha_draft = version
        self.article.public_version = self.published
        self.article.save()

        self.articlefeed = LastArticlesFeedRSS()
예제 #15
0
 def test_edit_with_more_than_max_ping(self):
     overridden_zds_app["comment"]["max_pings"] = 2
     pinged_users = [
         ProfileFactory(),
         ProfileFactory(),
         ProfileFactory(),
         ProfileFactory()
     ]
     self.client.force_login(self.user2)
     self.client.post(
         reverse("topic-new") + f"?forum={self.forum11.pk}",
         {
             "title":
             "Super sujet",
             "subtitle":
             "Pour tester les notifs",
             "text":
             "@{} @{} are pinged, not @{} @{}".format(
                 *[a.user.username for a in pinged_users]),
             "tags":
             "",
         },
         follow=False,
     )
     topic = Topic.objects.last()
     post = topic.last_message
     self.assertEqual(2, PingSubscription.objects.count())
     self.assertTrue(
         PingSubscription.objects.get_existing(pinged_users[0].user, post,
                                               True))
     self.assertTrue(
         PingSubscription.objects.get_existing(pinged_users[1].user, post,
                                               True))
     self.assertFalse(
         PingSubscription.objects.get_existing(pinged_users[2].user, post,
                                               True))
     self.assertFalse(
         PingSubscription.objects.get_existing(pinged_users[3].user, post,
                                               True))
     self.client.post(
         reverse("topic-edit") + f"?topic={topic.pk}",
         {
             "title": "Super sujet",
             "subtitle": "Pour tester les notifs",
             "text":
             f"@{pinged_users[1].user.username} @{pinged_users[3].user.username} are pinged",
             "tags": "",
         },
         follow=False,
     )
     self.assertTrue(
         PingSubscription.objects.get_existing(pinged_users[3].user, post,
                                               True))
     self.assertTrue(
         PingSubscription.objects.get_existing(pinged_users[1].user, post,
                                               True))
     self.assertFalse(
         PingSubscription.objects.get_existing(pinged_users[0].user, post,
                                               True))
예제 #16
0
    def setUp(self):

        self.overridden_zds_app["member"]["bot_account"] = ProfileFactory().user.username
        self.licence = LicenceFactory()

        self.user_author = ProfileFactory().user
        self.user_staff = StaffProfileFactory().user
        self.user_guest = ProfileFactory().user
예제 #17
0
파일: tests.py 프로젝트: Arnaud-D/zds-site
    def test_success_reaction_karma_like(self):
        author = ProfileFactory()
        reaction = ContentReactionFactory(author=author.user, position=1, related_content=self.content)

        profile = ProfileFactory()
        self.client.force_login(profile.user)
        response = self.client.put(reverse("api:content:reaction-karma", args=(reaction.pk,)), {"vote": "like"})
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertTrue(CommentVote.objects.filter(user=profile.user, comment=reaction, positive=True).exists())
예제 #18
0
    def setUp(self):
        self.user1 = ProfileFactory()
        self.staff = StaffProfileFactory()

        # Create a forum for later test
        self.forumcat = ForumCategoryFactory()
        self.forum = ForumFactory(category=self.forumcat)
        self.forumtopic = TopicFactory(forum=self.forum,
                                       author=self.staff.user)
예제 #19
0
class SubscriptionsTest(TestCase):
    def setUp(self):
        self.userStandard1 = ProfileFactory(email_for_answer=True,
                                            email_for_new_mp=True).user
        self.userOAuth1 = ProfileFactory(email_for_answer=True,
                                         email_for_new_mp=True).user
        self.userOAuth2 = ProfileFactory(email_for_answer=True,
                                         email_for_new_mp=True).user

        self.userOAuth1.email = ""
        self.userOAuth2.email = "this is not an email"

        self.userOAuth1.save()
        self.userOAuth2.save()

    def test_no_emails_for_those_who_have_none(self):
        """
        Test that we do not try to send e-mails to those who have not registered one.
        """
        self.assertEqual(0, len(mail.outbox))
        topic = send_mp(
            author=self.userStandard1,
            users=[self.userOAuth1],
            title="Testing",
            subtitle="",
            text="",
            send_by_mail=True,
            leave=False,
        )

        self.assertEqual(0, len(mail.outbox))

        send_message_mp(self.userOAuth1, topic, "", send_by_mail=True)

        self.assertEqual(1, len(mail.outbox))

    def test_no_emails_for_those_who_have_other_things_in_that_place(self):
        """
        Test that we do not try to send e-mails to those who have not registered a valid one.
        """
        self.assertEqual(0, len(mail.outbox))
        topic = send_mp(
            author=self.userStandard1,
            users=[self.userOAuth2],
            title="Testing",
            subtitle="",
            text="",
            send_by_mail=True,
            leave=False,
        )

        self.assertEqual(0, len(mail.outbox))

        send_message_mp(self.userOAuth2, topic, "", send_by_mail=True)

        self.assertEqual(1, len(mail.outbox))
예제 #20
0
 def test_new_cowritten_content_without_doubly_notif(self):
     author1 = ProfileFactory()
     author2 = ProfileFactory()
     NewPublicationSubscription.objects.toggle_follow(author2.user, author1.user)
     content = PublishedContentFactory(author_list=[author1.user, author2.user])
     signals.content_published.send(sender=content.__class__, instance=content, by_email=False)
     auto_user_1_sub = NewPublicationSubscription.objects.get_existing(author1.user, author1.user, False)
     self.assertIsNotNone(auto_user_1_sub)
     notifs = list(Notification.objects.get_notifications_of(author1.user))
     self.assertEqual(1, len(notifs))
예제 #21
0
 def setUp(self):
     self.nb_part = 1
     self.nb_chapter = 3
     self.nb_section = 1
     self.user_author = ProfileFactory().user
     self.user_staff = StaffProfileFactory().user
     self.user_guest = ProfileFactory().user
     self.published = self.get_published_content(
         self.user_author, self.user_staff, self.nb_part, self.nb_chapter, self.nb_section
     )
예제 #22
0
    def setUp(self):
        self.profile1 = ProfileFactory()
        self.profile2 = ProfileFactory()
        bot = Group(name=settings.ZDS_APP["member"]["bot_group"])
        bot.save()

        self.hat, _ = Hat.objects.get_or_create(name__iexact="A hat",
                                                defaults={"name": "A hat"})
        self.profile1.hats.add(self.hat)

        self.client.force_login(self.profile1.user)
예제 #23
0
    def test_success_post_karma_dislike(self):
        profile = ProfileFactory()
        category, forum = create_category_and_forum()
        topic = create_topic_in_forum(forum, profile)
        another_profile = ProfileFactory()
        post = PostFactory(topic=topic, author=another_profile.user, position=2)

        self.client.force_login(profile.user)
        response = self.client.put(reverse("api:forum:post-karma", args=(post.pk,)), {"vote": "dislike"})
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertTrue(CommentVote.objects.filter(user=profile.user, comment=post, positive=False).exists())
예제 #24
0
    def test_profiler(self):
        result = self.client.get("/?prof", follow=True)
        self.assertEqual(result.status_code, 200)

        admin = ProfileFactory()
        admin.user.is_superuser = True
        admin.save()
        self.client.force_login(admin.user)

        result = self.client.get("/?prof", follow=True)
        self.assertEqual(result.status_code, 200)
예제 #25
0
    def setUp(self):

        settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
        self.mas = ProfileFactory().user
        settings.ZDS_APP["member"]["bot_account"] = self.mas.username

        self.category, self.forum = create_category_and_forum()

        self.user = ProfileFactory().user
        self.staff = StaffProfileFactory().user

        self.index_manager = ESIndexManager(**settings.ES_SEARCH_INDEX)
예제 #26
0
    def setUp(self):
        self.user1 = ProfileFactory().user
        self.user2 = ProfileFactory().user
        self.user3 = ProfileFactory().user
        self.user1.profile.email_for_new_mp = True
        self.user2.profile.email_for_new_mp = True
        self.user3.profile.email_for_new_mp = False
        self.user1.profile.save()
        self.user2.profile.save()
        self.user3.profile.save()

        self.client.force_login(self.user1)
예제 #27
0
    def setUp(self):
        self.user1 = ProfileFactory().user
        self.user2 = ProfileFactory().user

        self.category1 = ForumCategoryFactory(position=1)
        self.forum11 = ForumFactory(category=self.category1, position_in_category=1)
        self.forum12 = ForumFactory(category=self.category1, position_in_category=2)

        self.tag1 = TagFactory(title="Linux")
        self.tag2 = TagFactory(title="Windows")

        self.client.force_login(self.user1)
예제 #28
0
 def setUp(self):
     self.profile1 = ProfileFactory()
     self.profile2 = ProfileFactory()
     self.profile3 = ProfileFactory()
     self.gallery1 = GalleryFactory()
     self.gallery2 = GalleryFactory()
     self.image1 = ImageFactory(gallery=self.gallery1)
     self.image2 = ImageFactory(gallery=self.gallery1)
     self.image3 = ImageFactory(gallery=self.gallery2)
     self.user_gallery1 = UserGalleryFactory(user=self.profile1.user, gallery=self.gallery1)
     self.user_gallery2 = UserGalleryFactory(user=self.profile1.user, gallery=self.gallery2)
     self.user_gallery3 = UserGalleryFactory(user=self.profile2.user, gallery=self.gallery1, mode="R")
예제 #29
0
    def setUp(self):
        self.profile1 = ProfileFactory()
        self.profile2 = ProfileFactory()
        self.topic1 = PrivateTopicFactory(author=self.profile1.user)
        self.topic1.participants.add(self.profile2.user)
        self.post1 = PrivatePostFactory(privatetopic=self.topic1,
                                        author=self.profile1.user,
                                        position_in_topic=1)

        self.post2 = PrivatePostFactory(privatetopic=self.topic1,
                                        author=self.profile2.user,
                                        position_in_topic=2)
예제 #30
0
    def setUp(self):
        self.userStandard1 = ProfileFactory(email_for_answer=True,
                                            email_for_new_mp=True).user
        self.userOAuth1 = ProfileFactory(email_for_answer=True,
                                         email_for_new_mp=True).user
        self.userOAuth2 = ProfileFactory(email_for_answer=True,
                                         email_for_new_mp=True).user

        self.userOAuth1.email = ""
        self.userOAuth2.email = "this is not an email"

        self.userOAuth1.save()
        self.userOAuth2.save()