diff bio/tests/test_forms.py @ 1011:164a39d985ef

Perform SSL image_check on profile text fields.
author Brian Neal <bgneal@gmail.com>
date Fri, 27 Nov 2015 15:45:05 -0600
parents 8789299c75b1
children
line wrap: on
line diff
--- a/bio/tests/test_forms.py	Fri Nov 27 15:44:06 2015 -0600
+++ b/bio/tests/test_forms.py	Fri Nov 27 15:45:05 2015 -0600
@@ -26,3 +26,26 @@
         form = EditUserProfileForm({})
         self.assertTrue(form.is_valid())
 
+    def test_profile_text_good(self):
+        post_data = {'profile_text': "This is my profile, no images."}
+        form = EditUserProfileForm(post_data)
+        self.assertTrue(form.is_valid())
+
+    def test_profile_text_bad_image(self):
+        post_data = {
+            'profile_text': "I'm cool. ![image](http://example.com/test.jpg)",
+        }
+        form = EditUserProfileForm(post_data)
+        self.assertFalse(form.is_valid())
+
+    def test_signature_good(self):
+        post_data = {'signature': "This is my signature, no images."}
+        form = EditUserProfileForm(post_data)
+        self.assertTrue(form.is_valid())
+
+    def test_signature_bad_image(self):
+        post_data = {
+            'signature': "I'm cool. ![image](http://example.com/test.jpg)",
+        }
+        form = EditUserProfileForm(post_data)
+        self.assertFalse(form.is_valid())