annotate messages/tests/test_forms.py @ 1166:130ac1e98cf4

More V3 forums tweaking. Adding attachments is working now. Adding a post via ajax is working. Still need to display attachments on posts.
author Brian Neal <bgneal@gmail.com>
date Sun, 20 Aug 2017 15:55:54 -0500
parents 82f1f6f905eb
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