Esempio n. 1
0
def test_get_from_database():
    from leaf.page import get_from_database
    node = mommy.make('leaf.PageNode', slug='test', template='example-page')
    page_class = mommy.make("leaf_test.PageClass", node=node)

    assert get_from_database('test/') == page_class
    assert get_from_database('test') == page_class
Esempio n. 2
0
def test_get_from_database_home_page():
    from leaf.page import get_from_database
    home_page = mommy.make('leaf.PageNode', slug='home', template='example-page')
    page_class = mommy.make("leaf_test.PageClass", node=home_page)

    assert get_from_database('') == page_class
    assert get_from_database('/') == page_class
    assert get_from_database('home') == page_class
    assert get_from_database('home/') == page_class
Esempio n. 3
0
def test_get_from_database_no_page_class():
    from leaf.page import get_from_database
    mommy.make('leaf.PageNode', slug='test', template='example-page')

    assert get_from_database('test/') is None
    assert get_from_database('test') is None
Esempio n. 4
0
def test_get_from_database_no_template():
    from leaf.page import get_from_database
    mommy.make('leaf.PageNode', slug='test')

    assert get_from_database('test/') is None
    assert get_from_database('test') is None