示例#1
0
    def setUp(self):
        self.test_comment_id = 1
        self.like1 = Like.objects.create(**get_test_like_fields(
            object_id=self.test_comment_id))
        self.like2 = Like.objects.create(**get_test_like_fields(
            object_id=self.test_comment_id))
        self.like3 = Like.objects.create(**get_test_like_fields(object_id=2))

        self.likes = [self.like1, self.like2]
示例#2
0
  def setUp(self):
    self.author = Author.objects.create(**get_test_author_fields())
    self.other_author = Author.objects.create(**get_test_author_fields())
    
    self.like1 = Like.objects.create(**get_test_like_fields(author=AuthorSerializer(self.author).data))
    self.like2 = Like.objects.create(**get_test_like_fields(author=AuthorSerializer(self.author).data))
    self.like3 = Like.objects.create(**get_test_like_fields(author=AuthorSerializer(self.other_author).data))

    self.likes = [self.like1, self.like2]
示例#3
0
 def test_send_like_to_inbox(self):
   fields = get_test_like_fields()
   fields['type'] = 'like'
   self.send_to_inbox(fields)
   
   # Ensure a Like model is saved into our database.
   self.assertTrue(Like.objects.get(object=fields['object']))
示例#4
0
 def setUp(self):
   client.force_authenticate(User.objects.create(username='******', password='******'))
   self.inbox = Inbox.objects.create(author=Author.objects.create(**get_test_author_fields()))
   self.inbox.items.append(get_test_post_fields())
   self.inbox.items.append(get_follow_author_fields())
   self.inbox.items.append(get_test_like_fields())
   self.inbox.save()
示例#5
0
 def setUp(self):
     self.fields = SimpleNamespace(**get_test_like_fields())
     self.like = Like.objects.create(**vars(self.fields))