Esempio n. 1
0
    def setUp(self):
        p = Page()
        p.title = 'Root Page'
        p.slug = 'root-page'
        p.depth = 0
        p.save()

        s = Site()
        s.root_page = p
        s.is_default_site = True
        s.hostname = 'localhost'
        s.port = 80
        s.save()
Esempio n. 2
0
def test_auto_recache(root_page, example_svg_upload):
    page = Page(title="nnep", slug="nnep")
    page.set_url_path(root_page)
    root_page.add_child(instance=page)
    page.save()
    assert page.url

    map = ImageMap.objects.create(svg=example_svg_upload)
    map.regions.create(element_id='blue', link_page=page)
    map.recache_svg(save=True)
    assert 'nnep' in map.rendered_svg
    page.slug = 'ffflop'
    page.save()  # The `post_save` triggers will get called...
    assert 'ffflop' in ImageMap.objects.get(pk=map.pk).rendered_svg