def test_mail_from_empty_email_empty(self): """ set_mail_from(message) returns the string in message['email_from'] when it is present, otherwise it returns 'default' """ # Build test environment builder = EnvironBuilder(method='POST', data={'name': 'Valid Guy', 'redirect': 'http://www.example.com', 'last_name': '', 'token': conf.TOKEN}) env = builder.get_environ() req = Request(env) # Create message from request and call set_mail_subject() message = handler.create_msg(req) mail_from = handler.set_mail_from(message) self.assertEqual(mail_from, 'from_default')
def test_set_mail_from(self): """ set_mail_from(message) returns the string in message['email_from'] when it is present, otherwise it returns 'default' """ # Build test environment builder = EnvironBuilder(method='POST', data={'name': 'Valid Guy', 'email': '*****@*****.**', 'redirect': 'http://www.example.com', 'last_name': '', 'mail_from': '*****@*****.**', 'token': conf.TOKEN}) env = builder.get_environ() req = Request(env) # Create message from request and call set_mail_subject() message = handler.create_msg(req) mail_from = handler.set_mail_from(message) # May want to change this email to be something else later on self.assertEqual(mail_from, '*****@*****.**')