예제 #1
0
    def _check_pre_publish(self, queryset):
        pre_published = []

        def pre_publish_handler(sender, instance, **kw):
            pre_published.append(instance)

        pre_publish.connect(pre_publish_handler, sender=Page)

        queryset.draft().publish()

        self.failUnlessEqual(queryset.draft().count(), len(pre_published))
        self.failUnlessEqual(set(queryset.draft()), set(pre_published))
예제 #2
0
    def test_deleted_flag_false_when_publishing_change(self):
        def pre_publish_handler(sender, instance, deleted, **kw):
            self.failIf(deleted)

        pre_publish.connect(pre_publish_handler, sender=Page)

        def post_publish_handler(sender, instance, deleted, **kw):
            self.failIf(deleted)

        post_publish.connect(post_publish_handler, sender=Page)

        self.page1.publish()
예제 #3
0
        def _check_pre_publish(self, queryset):
            pre_published = []

            def pre_publish_handler(sender, instance, **kw):
                pre_published.append(instance)

            pre_publish.connect(pre_publish_handler, sender=Page)

            queryset.draft().publish()

            self.failUnlessEqual(queryset.draft().count(), len(pre_published))
            self.failUnlessEqual(set(queryset.draft()), set(pre_published))
예제 #4
0
        def test_deleted_flag_false_when_publishing_change(self):
            def pre_publish_handler(sender, instance, deleted, **kw):
                self.failIf(deleted)

            pre_publish.connect(pre_publish_handler, sender=Page)

            def post_publish_handler(sender, instance, deleted, **kw):
                self.failIf(deleted)

            post_publish.connect(post_publish_handler, sender=Page)

            self.page1.publish()
예제 #5
0
        def test_deleted_flag_true_when_publishing_deletion(self):
            self.child1.publish()
            self.child1.public

            self.child1.delete()

            self.failUnlessEqual(Publishable.PUBLISH_DELETE, self.child1.publish_state)

            def pre_publish_handler(sender, instance, deleted, **kw):
                self.failUnless(deleted)

            pre_publish.connect(pre_publish_handler, sender=Page)

            def post_publish_handler(sender, instance, deleted, **kw):
                self.failUnless(deleted)

            post_publish.connect(post_publish_handler, sender=Page)

            self.child1.publish()
예제 #6
0
    def test_deleted_flag_true_when_publishing_deletion(self):
        self.child1.publish()
        self.child1.public

        self.child1.delete()

        self.failUnlessEqual(Publishable.PUBLISH_DELETE,
                             self.child1.publish_state)

        def pre_publish_handler(sender, instance, deleted, **kw):
            self.failUnless(deleted)

        pre_publish.connect(pre_publish_handler, sender=Page)

        def post_publish_handler(sender, instance, deleted, **kw):
            self.failUnless(deleted)

        post_publish.connect(post_publish_handler, sender=Page)

        self.child1.publish()
예제 #7
0
        def test_signals_sent_for_followed(self):
            pre_published = []

            def pre_publish_handler(sender, instance, **kw):
                pre_published.append(instance)

            pre_publish.connect(pre_publish_handler, sender=Page)

            published = []

            def post_publish_handler(sender, instance, **kw):
                published.append(instance)

            post_publish.connect(post_publish_handler, sender=Page)

            # publishing just children will also publish it's parent (if needed)
            # which should also fire signals

            self.child1.publish()

            self.failUnlessEqual(set([self.page1, self.child1]), set(pre_published))
            self.failUnlessEqual(set([self.page1, self.child1]), set(published))
예제 #8
0
    def test_signals_sent_for_followed(self):
        pre_published = []

        def pre_publish_handler(sender, instance, **kw):
            pre_published.append(instance)

        pre_publish.connect(pre_publish_handler, sender=Page)

        published = []

        def post_publish_handler(sender, instance, **kw):
            published.append(instance)

        post_publish.connect(post_publish_handler, sender=Page)

        # publishing just children will also publish it's parent (if needed)
        # which should also fire signals

        self.child1.publish()

        self.failUnlessEqual(set([self.page1, self.child1]),
                             set(pre_published))
        self.failUnlessEqual(set([self.page1, self.child1]), set(published))