view messages/tests/test_forms.py @ 1096:d9cd3180c12c

More GCalendar V3 conversion in progress. Built a brand new post editor. It is hardcoded into GCalendar right now. We will make it more general in the future.
author Brian Neal <bgneal@gmail.com>
date Tue, 14 Jun 2016 21:16:09 -0500
parents 82f1f6f905eb
children
line wrap: on
line source
"""Unit tests for the messages application forms."""

from django.contrib.auth.models import User
from django.test import TestCase

from messages.forms import ComposeForm


class ComposeFormTestCase(TestCase):
    fixtures = ['messages_test_users.json']

    def test_unsafe_image(self):
        data = {
            'receiver': 'pj',
            'subject': 'Test subject',
            'message': 'Hi ![image](http:example.com/a.jpg)',
        }
        user = User.objects.get(username='eddie')
        f = ComposeForm(user, data)
        self.assertFalse(f.is_valid())