Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_send_mail_with_subject(self):
self.app.bind('MailSmtpDriver', MailDriver)
self.assertEqual(MailManager(self.app).driver('smtp').to('').subject('test').message_subject, 'test')
def test_mail_manager_loads_container(self):
mailManager = MailManager(self.app)
self.assertTrue(mailManager.load_container(self.app))
def test_send_mail(self):
self.app.bind('MailSmtpDriver', MailDriver)
self.assertTrue(MailManager(self.app).driver('smtp').to('idmann509@gmail.com'))
def test_switch_mail_manager(self):
self.app.bind('MailSmtpDriver', MailDriver)
self.app.bind('MailTestDriver', Mailgun)
mail_driver = MailManager(self.app).driver('smtp')
assert isinstance(mail_driver.driver('test'), Mailgun)
def test_send_mail_with_from(self):
self.app.bind('MailSmtpDriver', MailDriver)
self.assertEqual(MailManager(self.app).driver('smtp').to('idmann509@gmail.com').send_from('masonite@masonite.com').from_address, 'masonite@masonite.com')
def test_send_mail_with_callable(self):
self.app.bind('MailSmtpDriver', MailDriver)
user = User
user.email = 'email@email.com'
assert MailManager(self.app).driver('smtp').to(User)
def test_does_not_raise_drivernotfound_exception(self):
MailManager(self.app)
def test_driver_loads_template(self):
self.app.bind('MailSmtpDriver', MailDriver)
driver = MailManager(self.app).driver('smtp')
self.assertEqual(driver.template('test', {'test': 'test'}).message_body, 'test')
def boot(self, view: View, request: Request):
"""Add helper functions to Masonite."""
builtins.view = view.render
builtins.request = request.helper
builtins.auth = request.user
builtins.container = self.app.helper
builtins.env = os.getenv
builtins.resolve = self.app.resolve
builtins.route = request.route
if self.app.has(MailManager):
builtins.mail_helper = self.app.make(MailManager).helper
builtins.dd = DD(self.app).dump
view.share(
{
'request': request.helper,
'auth': request.user,
'request_method': set_request_method,
'route': request.route,
'back': back,
'sign': sign,
'unsign': unsign,
'decrypt': decrypt,
'encrypt': encrypt,
'config': config,
'optional': optional,
'dd': builtins.dd,
def register(self):
from config import mail
self.app.bind('MailConfig', mail)
self.app.bind('MailSmtpDriver', MailSmtpDriver)
self.app.bind('MailMailgunDriver', MailMailgunDriver)
self.app.bind('MailLogDriver', MailLogDriver)
self.app.bind('MailTerminalDriver', MailTerminalDriver)
self.app.bind('MailManager', MailManager(self.app))