def test_escaping(self): pkg_activity = { "id": '">', # hacked somehow "timestamp": datetime.datetime(2018, 2, 1, 10, 58, 59), } out = h.activity_list_select([pkg_activity], "") html = out[0] assert str(html).startswith(u'<option value="">" >')
def test_simple(self): pkg_activity = { "id": "id1", "timestamp": datetime.datetime(2018, 2, 1, 10, 58, 59), } out = h.activity_list_select([pkg_activity], "") html = out[0] assert (str(html) == '<option value="id1" >February 1, 2018 at 10:58:59 AM UTC' "</option>") assert hasattr(html, "__html__") # shows it is safe Markup
def test_simple(self): pkg_activity = { 'id': 'id1', 'timestamp': datetime.datetime(2018, 2, 1, 10, 58, 59), } out = h.activity_list_select([pkg_activity], '') html = out[0] eq_( str(html), '<option value="id1" >February 1, 2018, 10:58:59 (UTC)' '</option>') assert hasattr(html, '__html__') # shows it is safe Markup