dummy_tests.py 1018 B

1234567891011121314151617181920212223242526272829303132333435
  1. """Tests for cement.ext.ext_dummy."""
  2. from cement.utils import test
  3. from cement.utils.misc import rando, init_defaults
  4. APP = "app-%s" % rando()[:12]
  5. class DummyOutputHandlerTestCase(test.CementTestCase):
  6. pass
  7. class DummyMailHandlerTestCase(test.CementTestCase):
  8. def test_dummy_mail(self):
  9. self.app.setup()
  10. self.app.run()
  11. res = self.app.mail.send("Test",
  12. to=['me@localhost'],
  13. from_addr='me@localhost',
  14. )
  15. self.ok(res)
  16. def test_dummy_mail_with_subject_prefix(self):
  17. defaults = init_defaults(APP, 'mail.dummy')
  18. defaults['mail.dummy']['subject_prefix'] = 'TEST PREFIX'
  19. app = self.make_app(APP, config_defaults=defaults)
  20. app.setup()
  21. app.run()
  22. res = app.mail.send("Test",
  23. to=['me@localhost'],
  24. from_addr='me@localhost',
  25. )
  26. self.ok(res)