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
|