def test_sslkey_display_is_HTML_safe(self): self.patch(sslkey_module, 'find_ssl_common_name').return_value = "<escape>" key_string = get_data('data/test_x509_0.pem') user = factory.make_User() key = SSLKey(key=key_string, user=user) display = key.display_html() self.assertThat(display, StartsWith("<escape>")) self.assertNotIn("<", display) self.assertNotIn(">", display)
def test_sslkey_display_is_marked_as_HTML_safe(self): key_string = get_data('data/test_x509_0.pem') user = factory.make_User() key = SSLKey(key=key_string, user=user) display = key.display_html() self.assertIsInstance(display, SafeString)