from django.test import TestCase
from ansible.forms import AnsibleForm1, AnsibleForm2

class AnsibleCreateFormTest(TestCase):
    def test_valid_ansibleform1(self):
        form = AnsibleForm1({
            'repository': "ansi-dst",
            'username': "lozadaomr"
        })
        self.assertTrue(form.is_valid())
        form1 = form.save()
        self.assertEqual(form1.repository, "ansi-dst")
        self.assertEqual(form1.username, "lozadaomr")

    def test_valid_ansibleform2(self):
        form = AnsibleForm2({
            'inventory': "hosts",
            'user': "ubuntu"
        })
        self.assertTrue(form.is_valid())
        form2 = form.save()
        self.assertEqual(form2.inventory, "hosts")
        self.assertEqual(form2.user, "ubuntu")

@@ -762,8 +762,1044 @@
 buntu%22)%0A
+%0A    def test_blank_ansibleform1(self):%0A        form = AnsibleForm1(%7B%0A            'repository': %22%22,%0A            'username': %22%22%0A        %7D)%0A        self.assertFalse(form.is_valid())%0A%0A    def test_blank_ansibleform2(self):%0A        form = AnsibleForm2(%7B%0A            'inventory': %22%22,%0A            'user': %22%22%0A        %7D)%0A        self.assertFalse(form.is_valid())%0A%0A    def test_blank_error_message_ansibleform1(self):%0A        error_msg = %5Bu'This field is required.'%5D%0A        form = AnsibleForm1(%7B%0A            'repository': %22%22,%0A            'username': %22%22%0A        %7D)%0A        self.assertEqual(form.errors.get('repository', None), error_msg)%0A        self.assertEqual(form.errors.get('username', None), error_msg)%0A%0A    def test_blank_error_message_ansibleform2(self):%0A        error_msg = %5Bu'This field is required.'%5D%0A        form = AnsibleForm2(%7B%0A            'inventory': %22%22,%0A            'user': %22%22%0A        %7D)%0A        self.assertEqual(form.errors.get('inventory', None), error_msg)%0A        self.assertEqual(form.errors.get('user', None), error_msg)%0A%0A

Test validation errors on test_forms.py