예제 #1
0
    def setUp(self):
        self.me = users_factories.ProfileFactory()
        self.client.force_authenticate(user=self.me.user)
        self.other = users_factories.ProfileFactory()
        self.thread = ThreadFactory(profile_1=self.me, profile_2=self.other)
        self.message1 = MessageFactory(thread=self.thread, sender=self.me)
        self.message2 = MessageFactory(thread=self.thread, sender=self.other)

        self.message1_json = MessageSerializer(message1).data
        self.message2_json = MessageSerializer(message2).data
예제 #2
0
 def setUp(self):
     self.profile = factories.ProfileFactory()
     self.client.force_authenticate(user=self.profile.user)
     self.blog = blogfactory.BlogFactory()
     self.comment = blogfactory.CommentFactory()
     self.comment.blog = self.blog
     self.comment2 = blogfactory.CommentFactory()
     self.comment3 = blogfactory.CommentFactory()
     self.comment4 = blogfactory.CommentFactory()
     self.comment5 = blogfactory.CommentFactory()
     self.comment6 = blogfactory.CommentFactory()
     self.comment7 = blogfactory.CommentFactory()
     self.comment8 = blogfactory.CommentFactory()
     self.comment6.blog = self.blog
     self.comment7.blog = self.blog
     self.comment8.blog = self.blog
     self.comment3.comment = self.comment
     self.comment4.comment = self.comment3
     self.comment5.comment = self.comment3
     self.comment2.comment = self.comment3
     self.comment.save()
     self.comment2.save()
     self.comment3.save()
     self.comment4.save()
     self.comment5.save()
     self.comment6.save()
     self.comment7.save()
     self.comment8.save()
     self.blog.save()
예제 #3
0
 def setUp(self):
     self.profile = factories.ProfileFactory()
     self.client.force_authenticate(user=self.profile.user)
     self.blog = blogfactory.BlogFactory()
     self.comment = blogfactory.CommentFactory()
     self.comment.user = self.profile.user
     self.comment.save()
     self.blog.save()
예제 #4
0
 def setUp(self):
     self.profile = factories.ProfileFactory()
     self.client.force_authenticate(user=self.profile.user)
     self.blog = blogfactory.BlogFactory()
     self.blog1 = blogfactory.BlogFactory()
     self.blog2 = blogfactory.BlogFactory()
     self.blog2.publish = False
     self.blog2.save()
     self.blog.title = 'TestQueryTitle'
     self.blog.save()
예제 #5
0
    def setUp(self):

        self.me = users_factories.ProfileFactory()
        self.client.force_authenticate(user=self.me.user)
        self.thread1 = ThreadFactory(profile_1=self.me)
        self.thread2 = ThreadFactory(profile_1=self.me)
        self.message = MessageFactory(thread=self.thread1)
        self.message1 = MessageFactory(thread=self.thread2)
        self.message2 = MessageFactory(thread=self.thread2)
        self.message3 = MessageFactory(thread=self.thread2)
예제 #6
0
    def test_thread_not_exists(self):
        self.other2 = users_factories.ProfileFactory()

        create_url = reverse('messaging:check_history',
                             kwargs={'profile_id': self.other2.id})

        resp = self.client.get(create_url, )

        self.assertFalse(resp.data['exists'])

        self.other2.user.delete()
예제 #7
0
    def test_create_invalid_user_blog(self):
        profile2 = factories.ProfileFactory()
        create_url = reverse('blog:createview',
                             kwargs={'username': profile2.get_username()})

        blog_params = {
            'title': 'test title',
            'body': 'test body',
            'anonymous': False
        }

        resp = self.client.post(
            create_url,
            data=blog_params,
        )

        self.assertFalse(
            BlogPost.objects.filter(
                user__username__iexact=self.profile.user.username).exists())
예제 #8
0
 def setUp(self):
     self.profile = users_factories.ProfileFactory()
     self.mentor = users_factories.MentorFactory(profile=self.profile)
     self.client.force_authenticate(user=self.profile.user)
예제 #9
0
 def setUp(self):
     self.profile = factories.ProfileFactory()
     self.client.force_authenticate(user=self.profile.user)
예제 #10
0
 def setUp(self):
     self.profile = factories.ProfileFactory()
     self.client.force_authenticate(user=self.profile.user)
     self.blog = blogfactory.BlogFactory()
     self.ablog = blogfactory.AnonymousBlogFactory()
예제 #11
0
 def setUp(self):
     self.me = users_factories.ProfileFactory()
     self.client.force_authenticate(user=self.me.user)
     self.other1 = users_factories.ProfileFactory()
     self.other2 = users_factories.ProfileFactory()
예제 #12
0
 def setUp(self):
     self.me = users_factories.ProfileFactory()
     self.client.force_authenticate(user=self.me.user)
     self.other = users_factories.ProfileFactory()
     self.thread = ThreadFactory(profile_1=self.me, profile_2=self.other)