test: fix issue with local dev tests for email settings
in my case i had wuttasync installed, which provides email settings, but the test setup does not configure default import/export handlers, which prevents those email settings from loading correctly. so restrict to some "basic" email settings and avoid anything else, to prevent the issue
This commit is contained in:
parent
65d104a098
commit
f8cb97ce63
1 changed files with 27 additions and 14 deletions
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from wuttjamaican.email import EmailSetting
|
||||
from wuttjamaican.email import EmailSetting, EmailHandler
|
||||
|
||||
import colander
|
||||
from pyramid.httpexceptions import HTTPNotFound
|
||||
from pyramid.response import Response
|
||||
|
||||
from wuttaweb import emails as wuttaweb_emails
|
||||
from wuttaweb.views import email as mod
|
||||
from wuttaweb.testing import WebTestCase
|
||||
|
||||
|
|
@ -23,6 +24,12 @@ class TestEmailSettingViews(WebTestCase):
|
|||
def test_get_grid_data(self):
|
||||
self.config.setdefault("wutta.email.default.sender", "test@example.com")
|
||||
view = self.make_view()
|
||||
|
||||
# nb. avoid issues with arbitrary installed packages
|
||||
email_modules = [wuttaweb_emails]
|
||||
with patch.object(
|
||||
EmailHandler, "get_email_modules", return_value=email_modules
|
||||
):
|
||||
data = view.get_grid_data()
|
||||
self.assertIsInstance(data, list)
|
||||
self.assertTrue(data) # 1+ items
|
||||
|
|
@ -37,6 +44,12 @@ class TestEmailSettingViews(WebTestCase):
|
|||
def test_configure_grid(self):
|
||||
self.config.setdefault("wutta.email.default.sender", "test@example.com")
|
||||
view = self.make_view()
|
||||
|
||||
# nb. avoid issues with arbitrary installed packages
|
||||
email_modules = [wuttaweb_emails]
|
||||
with patch.object(
|
||||
EmailHandler, "get_email_modules", return_value=email_modules
|
||||
):
|
||||
grid = view.make_model_grid()
|
||||
self.assertIn("key", grid.searchable_columns)
|
||||
self.assertIn("subject", grid.searchable_columns)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue