예제 #1
0
    def test_change_microblogging_authorship_updates_template_text(self):
        hugo = create_user('hugo')
        create_user('herbert')
        arno = create_user('arno')

        post = create_post('hallo @hugo ich bins @herbert!', hugo)
        post.save()
        self.assertEqual(post.text_template, 'hallo {u0} ich bins {u1}!')
        change_microblogging_authorship(hugo, arno)
        post = Post.objects.get(id=post.id)  # update object from DB

        self.assertEqual(post.text_template, 'hallo {u1} ich bins {u0}!')
예제 #2
0
    def test_change_microblogging_authorship_updates_mentions(self):
        hugo = create_user('hugo')
        create_user('herbert')
        arno = create_user('arno')

        post = create_post('hallo @hugo ich bins @herbert!', hugo)
        post.save()

        change_microblogging_authorship(hugo, arno)
        post = Post.objects.get(id=post.id)  # update object from DB

        self.assertNotIn(hugo, post.mentions.all())
        self.assertIn(arno, post.mentions.all())
예제 #3
0
    def test_change_microblogging_authorship_can_deal_with_duplications(self):
        hugo = create_user('hugo')
        herbert = create_user('herbert')

        post = create_post('hallo @hugo ich bins @herbert!', hugo)
        post.save()
        self.assertEqual(post.text_template, 'hallo {u0} ich bins {u1}!')
        change_microblogging_authorship(hugo, herbert)
        post = Post.objects.get(id=post.id)  # update object from DB

        self.assertNotIn(hugo, post.mentions.all())
        self.assertIn(herbert, post.mentions.all())

        self.assertEqual(post.text_template, 'hallo {u0} ich bins {u0}!')