Пример #1
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)
Пример #2
0
 def test_top_level_message_is_log_returns_false_for_content_type_not_genericparty(
         self):
     make_task_tree(
         self
     )  #A function we borrowed from the .do app.  Add .task_tree (a Task object) to this class.
     message = TopLevelMessage.objects.create(
         creator=self.sender,
         content_object=self.task_tree,
         message=
         "Ding Dong Llama Wani Jumpin' With An Icepick She Thinks I'm...... Goin' in."
     )
     self.assertFalse(message.is_log())
Пример #3
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)
Пример #4
0
 def test_top_level_message_is_log_returns_false_for_content_type_not_genericparty(self):
     make_task_tree(self) #A function we borrowed from the .do app.  Add .task_tree (a Task object) to this class.
     message = TopLevelMessage.objects.create(creator=self.sender, content_object=self.task_tree, message="Ding Dong Llama Wani Jumpin' With An Icepick She Thinks I'm...... Goin' in.")
     self.assertFalse(message.is_log())