Esempio n. 1
0
 def test_render_allows_markup_in_message_but_escapes_context(self):
     message = "<foo>{bar}</foo>"
     context = {"bar": "<BAR>"}
     notification = Notification(message=message, context=context)
     self.assertThat(
         notification.render(), Equals("<foo>&lt;BAR&gt;</foo>")
     )
Esempio n. 2
0
 def test_render_combines_message_with_context(self):
     thing_a = factory.make_name("a")
     thing_b = random.randrange(1000)
     message = "There are {b:d} of {a} in my suitcase."
     context = {"a": thing_a, "b": thing_b}
     notification = Notification(message=message, context=context)
     self.assertThat(
         notification.render(),
         Equals("There are " + str(thing_b) + " of " + thing_a +
                " in my suitcase."))