Esempio n. 1
0
 def test_rejection_activity_stream(self):
     member = TeamMember(user=self.user, team=self.team, role=TeamMember.ROLE_MANAGER)
     member.save()
     add_moderation(self.video, self.team, self.user)
     v1 = self._create_versions(self.video.subtitle_language(), num_versions=1)[0]
     count = Action.objects.all().count()
     reject_version(v1, self.team, self.user)
     self.assertEquals(count + 1, Action.objects.all().count())
     act  = Action.objects.all().order_by("-created")[0]
     act.action_type == Action.REJECT_VERSION
Esempio n. 2
0
 def test_on_unmoderation_rejected_never_last(self):
    tv = self.team.teamvideo_set.all()[0]
    add_moderation(tv.video, tv.team, self.user)
    self.assertEquals(tv.team.get_pending_moderation().count() , 0)
    versions = self._create_versions( tv.video.subtitle_language(), num_versions=2)
    v0_subs_text = versions[0].subtitles()[0].text
    v1_subs_text = versions[1].subtitles()[0].text
    approve_version(versions[0], tv.team, self.user)
    num_versions = SubtitleVersion.objects.filter(language__video=tv.video).count()
    reject_version(versions[1], tv.team, self.user, None, self.user2)
    # we should roll back
    self.assertEquals(SubtitleVersion.objects.filter(language__video=tv.video).count(),num_versions +1)
    self.assertEquals( tv.video.subtitle_language().latest_version(), versions[0])
    remove_moderation(tv.video, tv.team, self.user)
    # the last one must be v0 -> the one approved
    self.assertEquals(tv.video.subtitle_language().latest_version().subtitles()[0].text , v0_subs_text)