Ejemplo n.º 1
0
    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_contents(user="******", page="<div id='infos'></div>"), is_(u'<div id="infos"><p>Something happened hÉ</p></div>'))
        assert_that(add_cms_contents(user="******", page='<div id="news">my news</div>'), is_(u'<div id="news">my news</div>'))
Ejemplo n.º 2
0
    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_contents("fangiot", page)
        assert_that(cms_page, is_html_equal(expected_page))
Ejemplo n.º 3
0
    def post(self, user):
        dom = self.get_argument("dom")
        response = add_cms_contents(user, dom)
	self.write(response)