diff options
author | Bruno Wagner Gonçalves <bwagner@riseup.net> | 2015-11-10 11:17:37 -0200 |
---|---|---|
committer | Bruno Wagner Gonçalves <bwagner@riseup.net> | 2015-11-10 11:17:37 -0200 |
commit | 78816e67fc1cd40fe23292904133d0a6d588e419 (patch) | |
tree | ee5d14223a7ad23518cfb15c531cb3a582bca4af /service/test | |
parent | 3ec84c9b81161684341c0c31eabe003bbae4e5ba (diff) | |
parent | ef86d4458c21f1d722fb162423cd3dfeea055844 (diff) |
Merge pull request #502 from sw00/master
show user email address in title
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/support/integration/app_test_client.py | 2 | ||||
-rw-r--r-- | service/test/unit/adapter/test_mail_service.py | 2 | ||||
-rw-r--r-- | service/test/unit/resources/test_root_resource.py | 30 |
3 files changed, 32 insertions, 2 deletions
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index 369a393d..484bea6e 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -166,7 +166,7 @@ class AppTestClient(object): return mail_sender def _create_mail_service(self, mail_sender, mail_store, search_engine): - mail_service = MailService(mail_sender, mail_store, search_engine) + mail_service = MailService(mail_sender, mail_store, search_engine, self.MAIL_ADDRESS) return mail_service def _generate_soledad_test_folder_name(self, soledad_test_folder='/tmp/soledad-test/test'): diff --git a/service/test/unit/adapter/test_mail_service.py b/service/test/unit/adapter/test_mail_service.py index 6faf5140..1ec3806e 100644 --- a/service/test/unit/adapter/test_mail_service.py +++ b/service/test/unit/adapter/test_mail_service.py @@ -37,7 +37,7 @@ class TestMailService(unittest.TestCase): self.mail_sender = mock() self.search_engine = mock() - self.mail_service = MailService(self.mail_sender, self.mail_store, self.search_engine) + self.mail_service = MailService(self.mail_sender, self.mail_store, self.search_engine, 'acount@email') def tearDown(self): unstub() diff --git a/service/test/unit/resources/test_root_resource.py b/service/test/unit/resources/test_root_resource.py new file mode 100644 index 00000000..4cdaf97a --- /dev/null +++ b/service/test/unit/resources/test_root_resource.py @@ -0,0 +1,30 @@ +import unittest +import re +from mockito import mock, when +from test.unit.resources import DummySite +from twisted.web.test.requesthelper import DummyRequest +from pixelated.resources.root_resource import RootResource + + +class TestRootResource(unittest.TestCase): + MAIL_ADDRESS = 'test_user@pixelated-project.org' + + def setUp(self): + root_resource = RootResource() + root_resource._mode = root_resource + root_resource.account_email = self.MAIL_ADDRESS + root_resource._html_template = "<html><head><title>$account_email</title></head></html>" + self.web = DummySite(root_resource) + + def test_render_GET_should_template_account_email(self): + request = DummyRequest(['']) + + d = self.web.get(request) + + def assert_response(_): + expected = "<title>{0}</title>".format(self.MAIL_ADDRESS) + matches = re.findall(expected, request.written[0]) + self.assertEquals(len(matches), 1) + + d.addCallback(assert_response) + return d |