"""accounts app unittests for forms

"""
from django.test import TestCase

from accounts.forms import LoginForm


class LoginFormTest(TestCase):
    """Tests the form which validates the email used for login.

    """
    def test_valid_email_accepted(self):
        form = LoginForm({'email': 'newvisitor@example.com'})
        self.assertTrue(form.is_valid())

    def test_invalid_email_declined(self):
        form = LoginForm({'email': 'invalidemail'})
        self.assertFalse(form.is_valid())

@@ -34,16 +34,27 @@
 ms%0A%0A%22%22%22%0A
+import re%0A%0A
 from dja
@@ -77,16 +77,61 @@
 TestCase
+, RequestFactory%0Afrom django.core import mail
 %0A%0Afrom a
@@ -267,16 +267,138 @@
     %22%22%22%0A
+    def setUp(self):%0A        self.test_email = 'newvisitor@example.com'%0A        self.request = RequestFactory().get('/')%0A%0A
     def 
@@ -469,32 +469,23 @@
 l': 
-'newvisitor@example.com'
+self.test_email
 %7D)%0A 
@@ -646,24 +646,514 @@
 tFalse(form.is_valid())%0A
+%0A    def test_can_send_email(self):%0A        form = LoginForm(%7B'email': self.test_email%7D)%0A        if form.is_valid():%0A            form.save(self.request)%0A        self.assertEqual(len(mail.outbox), 1)%0A%0A    def test_email_contains_link(self):%0A        form = LoginForm(%7B'email': self.test_email%7D)%0A        if form.is_valid():%0A            form.save(self.request)%0A        email = mail.outbox%5B0%5D%0A        url_search = re.search(r'http://.+/.+$', email.body)%0A        self.assertIsNotNone(url_search)%0A

Add more loginform tests