Exemple #1
0
 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("&lt;escape&gt;"))
     self.assertNotIn("<", display)
     self.assertNotIn(">", display)
Exemple #2
0
 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)