def test_syncs_pagestate_before_publishing(self):
        page = create(Builder("sl content page"))
        create(Builder("sl textblock").within(page))
        self.assertEquals([], flattened_block_uids(IPageConfiguration(page).load()))

        page.restrictedTraverse("@@publisher.publish")()
        self.assertEquals(["staticuid00000000000000000000002"], flattened_block_uids(IPageConfiguration(page).load()))
Exemple #2
0
    def test_syncs_pagestate_before_publishing(self):
        page = create(Builder('sl content page'))
        create(Builder('sl textblock').within(page))
        self.assertEquals([],
                          flattened_block_uids(
                              IPageConfiguration(page).load()))

        page.restrictedTraverse('@@publisher.publish')()
        self.assertEquals(['staticuid00000000000000000000002'],
                          flattened_block_uids(
                              IPageConfiguration(page).load()))
    def test_flattened_block_uids(self):
        config = {'default': [{'cols': [{'blocks': [{'uid': 'foo'}]}]},
                              {'cols': [{'blocks': [{'uid': 'bar'}]},
                                        {'blocks': []}]}],
                  'sidebar': [{'cols': [{'blocks': [{'uid': 'baz'},
                                                    {'uid': 'foobar'}]}]}]}

        self.assertEquals(['foo', 'bar', 'baz', 'foobar'],
                          flattened_block_uids(config))
    def test_flattened_block_uids(self):
        config = {
            "default": [
                {"cols": [{"blocks": [{"uid": "foo"}]}]},
                {"cols": [{"blocks": [{"uid": "bar"}]}, {"blocks": []}]},
            ],
            "sidebar": [{"cols": [{"blocks": [{"uid": "baz"}, {"uid": "foobar"}]}]}],
        }

        self.assertEquals(["foo", "bar", "baz", "foobar"], flattened_block_uids(config))