예제 #1
0
 def test_no_alert_on_unpublish(self):
     """related to #4860"""
     published = PublishedContentFactory(type='OPINION', author_list=[self.user_author])
     reaction = ContentReactionFactory(related_content=published, author=ProfileFactory().user, position=1,
                                       pubdate=datetime.datetime.now())
     Alert.objects.create(scope='CONTENT', comment=reaction, text='a text', author=ProfileFactory().user,
                          pubdate=datetime.datetime.now(), content=published)
     staff = StaffProfileFactory().user
     self.assertEqual(1, get_header_notifications(staff)['alerts']['total'])
     unpublish_content(published, staff)
     self.assertEqual(0, get_header_notifications(staff)['alerts']['total'])
예제 #2
0
 def test_no_alert_on_unpublish(self):
     """related to #4860"""
     published = PublishedContentFactory(type='OPINION',
                                         author_list=[self.user_author])
     reaction = ContentReactionFactory(related_content=published,
                                       author=ProfileFactory().user,
                                       position=1,
                                       pubdate=datetime.datetime.now())
     Alert.objects.create(scope='CONTENT',
                          comment=reaction,
                          text='a text',
                          author=ProfileFactory().user,
                          pubdate=datetime.datetime.now(),
                          content=published)
     staff = StaffProfileFactory().user
     self.assertEqual(1, get_header_notifications(staff)['alerts']['total'])
     unpublish_content(published, staff)
     self.assertEqual(0, get_header_notifications(staff)['alerts']['total'])
예제 #3
0
 def test_only_one_notif_on_major_update(self):
     NewPublicationSubscription.objects.get_or_create_active(self.user1, self.user2)
     content = PublishedContentFactory(author_list=[self.user2])
     notify_update(content, False, True)
     versioned = content.load_version()
     content.sha_draft = versioned.repo_update(introduction='new intro', conclusion='new conclusion',
                                               title=versioned.title)
     content.save(force_slug_update=False)
     publish_content(content, content.load_version(), True)
     notify_update(content, True, True)
     notifs = get_header_notifications(self.user1)['general_notifications']['list']
     self.assertEqual(1, len(notifs), str(notifs))