示例#1
0
 def test_autonomous_system_email_form(self):
     email = Email.objects.create(name="E-mail", subject="Hello", template="World")
     test = AutonomousSystemEmailForm(
         data={
             "email": email.pk,
             "recipient": "*****@*****.**",
             "subject": "Hello",
             "body": "World",
         }
     )
     test.fields["recipient"].choices = [("*****@*****.**", "Hello")]
     self.assertTrue(test.is_valid())
示例#2
0
 def test_autonomous_system_email_form(self):
     template = Template.objects.create(name="E-mail",
                                        type=TEMPLATE_TYPE_EMAIL,
                                        template="Hello")
     test = AutonomousSystemEmailForm(
         data={
             "template": template.pk,
             "recipient": "*****@*****.**",
             "subject": "Test",
             "body": "Hello",
         })
     test.fields["recipient"].choices = [("*****@*****.**", "Test")]
     self.assertTrue(test.is_valid())
示例#3
0
 def test_autonomous_system_email_form(self):
     email = Email.objects.create(name="E-mail", subject="Hello", template="World")
     test = AutonomousSystemEmailForm(
         data={
             "email": email.pk,
             "recipient": ["*****@*****.**"],
             "cc": ["*****@*****.**", "*****@*****.**"],
             "subject": "Hello",
             "body": "World",
         }
     )
     test.fields["recipient"].choices = [("*****@*****.**", "My Email")]
     test.fields["cc"].choices = [
         ("*****@*****.**", "Contact #1"),
         ("*****@*****.**", "Contact #2"),
     ]
     self.assertTrue(test.is_valid())