Mercurial > public > sg101
annotate messages/tests/test_forms.py @ 1022:82f1f6f905eb
Perform image_check on private messages.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 09 Dec 2015 21:16:04 -0600 |
parents | |
children |
rev | line source |
---|---|
bgneal@1022 | 1 """Unit tests for the messages application forms.""" |
bgneal@1022 | 2 |
bgneal@1022 | 3 from django.contrib.auth.models import User |
bgneal@1022 | 4 from django.test import TestCase |
bgneal@1022 | 5 |
bgneal@1022 | 6 from messages.forms import ComposeForm |
bgneal@1022 | 7 |
bgneal@1022 | 8 |
bgneal@1022 | 9 class ComposeFormTestCase(TestCase): |
bgneal@1022 | 10 fixtures = ['messages_test_users.json'] |
bgneal@1022 | 11 |
bgneal@1022 | 12 def test_unsafe_image(self): |
bgneal@1022 | 13 data = { |
bgneal@1022 | 14 'receiver': 'pj', |
bgneal@1022 | 15 'subject': 'Test subject', |
bgneal@1022 | 16 'message': 'Hi ![image](http:example.com/a.jpg)', |
bgneal@1022 | 17 } |
bgneal@1022 | 18 user = User.objects.get(username='eddie') |
bgneal@1022 | 19 f = ComposeForm(user, data) |
bgneal@1022 | 20 self.assertFalse(f.is_valid()) |
bgneal@1022 | 21 |