Ignore:
Timestamp:
10 Sep 2013, 14:21:37 (11 years ago)
Author:
uli
Message:

We need a smarter message box handling. Test it first.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.cas/trunk/waeup/cas/tests/test_server.py

    r10601 r10604  
    1717    create_tgc_value, check_login_ticket, set_session_cookie,
    1818    check_session_cookie, get_template, delete_session_cookie,
    19     check_service_ticket, update_url
     19    check_service_ticket, update_url, set_message
    2020    )
    2121
     
    311311        assert resp.status == '200 OK'
    312312        assert resp.content_type == 'text/css'
     313
     314    def test_set_message(self):
     315        # we can set a message
     316        result = set_message('Hi there', '<body>MSG_TEXT</body>')
     317        assert result == '<body>Hi there</body>'
     318
     319    def test_set_message_empty_or_none(self):
     320        # without a message, no message text will be displayed
     321        result = set_message('', '<body>MSG_TEXT</body>')
     322        assert result == '<body></body>'
     323        result = set_message('', '<body><div id="msg">MSG_TEXT</div></body>')
     324        assert result == '<body></body>'
     325        result = set_message(None, '<body><div id="msg">MSG_TEXT</div></body>')
     326        assert result == '<body></body>'
     327        result = set_message(
     328            None,
     329            '<body><div a="1">\n<div id="msg">MSG_TEXT</div>a\n</div></body>')
     330        assert result == '<body><div a="1">\na\n</div></body>'
     331        result = set_message(
     332            None,
     333            '<body><div a="1"><div id="msg">MSG_TEXT</div>a</div></body>')
     334        assert result == '<body><div a="1">a</div></body>'
    313335
    314336
Note: See TracChangeset for help on using the changeset viewer.