def test_get_content_for_page(self): add_content_type(type="infos", user="******", layout="<p>{{content}}</p>", selector="#infos", unique=True) add_content_type(type="other", user="******", layout="<p>{{content}}</p>", selector="#other") add_content(user="******", type="infos", content=u"Something happened hÉ") add_content(user="******", type="other", content=u"Other") assert_that(add_cms_contain(user="******", page="<div id='infos'></div>"), is_(u'<div id="infos"><p>Something happened hÉ</p></div>')) assert_that(add_cms_contain(user="******", page='<div id="news">my news</div>'), is_(u'<div id="news">my news</div>'))
def test_add_a_newslist(self): user = "******" page = """<html> <body> <h1>My personnel page</h1> <h2>My information</h2> <p>I am Anthony</p> <div id="newslist"></div> </body> </html>""" expected_page = u"""<html> <body> <h1>My personnel page</h1> <h2>My information</h2> <p>I am Anthony</p> <div id="newslist"> <ul> <li>I am happy</li> <li>Woaw, wonderful day!</li> </ul> </div> </body> </html>""" layout = """<ul> {% for content in contents %} <li>{{ content }}</li> {% endfor %} </ul>""" add_content_type(type="news", user="******", layout=layout, selector="#newslist") add_content(type="news", user="******", content="I am happy") add_content(type="news", user="******", content="Woaw, wonderful day!") cms_page = add_cms_contain("fangiot", page) assert_that(cms_page, is_html_equal(expected_page))
def test_register_content(self): add_content_type(type="content", user="******", layout="<>", selector="kd") add_content(user="******", type="content", content="my content") assert_that(Content.objects.filter(type="content").count(), is_(1))