Пример #1
0
 def test_email_to_blast(self):
     self.assertFalse(BlastMessage.objects.filter(message__contains="llamas").exists())
     
     role = Role.objects.create(name="scholar")
     group = Group.objects.create(name="Knights of the Round Table")
     role_in_group = RoleInGroup.objects.create(role=role, group=group)
     brother_maynard = User.objects.create(username="******", email="*****@*****.**")
     
     email_handler_command = EmailHandlerCommand()
     email_handler_command.handle('%s/what_apps/contact/management/commands/sample_email_to_blast.txt' % settings.PROJECT_ROOT )
     
     self.assertTrue(BlastMessage.objects.filter(message__contains="Llamas are awesome.").exists())
Пример #2
0
    def test_email_to_object_is_parsed(self):
        ron = User.objects.create(
            username="******", email="*****@*****.**"
        )  #Email matches "sender" in our test email doc
        ron.set_password('password')
        ron.save()

        make_task_tree(
            self
        )  #So that we have a Task object to which to send this message.

        email_handler_command = EmailHandlerCommand()

        #This email text is from Ron Lumbergh, the user above.  The innotrode guy - the young guy.
        #It is to [email protected] - the email address of the task we made using make_task_tree.
        email_msg = email_handler_command.handle(
            '%s/what_apps/contact/management/commands/sample_email_to_object.txt'
            % settings.PROJECT_ROOT)

        task = Task.objects.get(
            id=1)  #Here's the task to which we sent the email.
        #Now Ron will login and verify that his message is displayed on the page.

        self.client.login(username="******", password="******")
        task_url_response = self.client.get(task.get_absolute_url())
        self.assertTrue("Llamas are awesome." in task_url_response.content)
Пример #3
0
 def test_email_to_handler_is_parsed(self):
     MailHandler.objects.create(address="test-handler") 
     email_handler_command = EmailHandlerCommand()
     
     email_msg = email_handler_command.handle('%s/what_apps/contact/management/commands/sample_email_to_handler.txt' % settings.PROJECT_ROOT )
     
     pass
Пример #4
0
    def test_email_to_handler_is_parsed(self):
        MailHandler.objects.create(address="test-handler")
        email_handler_command = EmailHandlerCommand()

        email_msg = email_handler_command.handle(
            '%s/what_apps/contact/management/commands/sample_email_to_handler.txt'
            % settings.PROJECT_ROOT)

        pass
Пример #5
0
    def test_email_to_blast(self):
        self.assertFalse(
            BlastMessage.objects.filter(message__contains="llamas").exists())

        role = Role.objects.create(name="scholar")
        group = Group.objects.create(name="Knights of the Round Table")
        role_in_group = RoleInGroup.objects.create(role=role, group=group)
        brother_maynard = User.objects.create(
            username="******",
            email="*****@*****.**")

        email_handler_command = EmailHandlerCommand()
        email_handler_command.handle(
            '%s/what_apps/contact/management/commands/sample_email_to_blast.txt'
            % settings.PROJECT_ROOT)

        self.assertTrue(
            BlastMessage.objects.filter(
                message__contains="Llamas are awesome.").exists())
Пример #6
0
    def test_email_to_object_is_parsed(self):
        ron = User.objects.create(username="******", email="*****@*****.**") #Email matches "sender" in our test email doc
        ron.set_password('password')
        ron.save()
        
        make_task_tree(self) #So that we have a Task object to which to send this message.
        
        email_handler_command = EmailHandlerCommand()
        
        #This email text is from Ron Lumbergh, the user above.  The innotrode guy - the young guy.
        #It is to [email protected] - the email address of the task we made using make_task_tree.
        email_msg = email_handler_command.handle('%s/what_apps/contact/management/commands/sample_email_to_object.txt' % settings.PROJECT_ROOT )

        task = Task.objects.get(id=1) #Here's the task to which we sent the email.
        #Now Ron will login and verify that his message is displayed on the page.
        
        self.client.login(username="******", password="******")
        task_url_response = self.client.get(task.get_absolute_url())
        self.assertTrue("Llamas are awesome." in task_url_response.content)
Пример #7
0
 def test_email_to_blast_from_unknown_user(self):
     email_handler_command = EmailHandlerCommand()
     email_msg = email_handler_command.handle(
         '%s/what_apps/contact/management/commands/sample_email_blast_from_unknown_user.txt'
         % settings.PROJECT_ROOT)
     self.assertFalse(email_msg)
Пример #8
0
 def test_email_to_blast_from_unknown_user(self):
     email_handler_command = EmailHandlerCommand()
     email_msg = email_handler_command.handle('%s/what_apps/contact/management/commands/sample_email_blast_from_unknown_user.txt' % settings.PROJECT_ROOT )
     self.assertFalse(email_msg)