コード例 #1
0
ファイル: test_websites.py プロジェクト: marticongost/woost
    def test_index_is_updated_after_deleting_website(self):

        from woost.models import Website, Publishable

        index = Publishable.per_website_publication_index

        w1 = Website()
        w1.insert()

        w2 = Website()
        w2.insert()

        p1 = Publishable()
        p1.websites = [w1]
        p1.insert()

        p2 = Publishable()
        p2.websites = [w1, w2]
        p2.insert()

        w1.delete()
        assert set(index.items()) == set([(None, p1.id), (w2.id, p2.id)])

        w2.delete()
        assert set(index.items()) == set([(None, p1.id), (None, p2.id)])
コード例 #2
0
ファイル: test_websites.py プロジェクト: marticongost/woost
    def test_content_can_change_its_designated_websites(self):

        from woost.models import Website, Publishable

        index = Publishable.per_website_publication_index

        p1 = Publishable()
        p1.insert()

        w1 = Website()
        w1.insert()

        w2 = Website()
        w2.insert()

        assert list(index.items()) == [(None, p1.id)]

        p1.websites = [w1]
        assert list(index.items()) == [(w1.id, p1.id)]

        p1.websites = [w2]
        assert list(index.items()) == [(w2.id, p1.id)]

        p1.websites = [w1, w2]
        assert set(index.items()) == set([(w1.id, p1.id), (w2.id, p1.id)])

        p1.websites = []
        assert list(index.items()) == [(None, p1.id)]
コード例 #3
0
ファイル: test_websites.py プロジェクト: marticongost/woost
    def test_content_is_not_indexed_until_website_is_inserted(self):

        from woost.models import Website, Publishable

        index = Publishable.per_website_publication_index

        w1 = Website()

        p1 = Publishable()
        p1.insert()
        p1.websites = [w1]
        
        assert (w1.id, p1.id) not in list(index.items())
コード例 #4
0
ファイル: test_websites.py プロジェクト: marticongost/woost
    def test_index_is_updated_after_deleting_publishable(self):

        from woost.models import Website, Publishable

        index = Publishable.per_website_publication_index

        p1 = Publishable()
        p1.insert()
        p1.delete()

        assert (None, p1.id) not in list(index.items())

        w1 = Website()
        w1.insert()

        p2 = Publishable()
        p2.websites = [w1]
        p2.insert()
        p2.delete()

        assert not list(index.items())