diff options
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/support/integration/app_test_client.py | 12 | ||||
-rw-r--r-- | service/test/unit/config/test_dispatcher.py | 20 |
2 files changed, 16 insertions, 16 deletions
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index 5e52732b..7de6d5b5 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -35,7 +35,7 @@ from pixelated.adapter.services.draft_service import DraftService from pixelated.adapter.services.mail_service import MailService from pixelated.adapter.services.mailboxes import Mailboxes from pixelated.adapter.soledad.soledad_querier import SoledadQuerier -from pixelated.config import App +from pixelated.config.config import Config from pixelated.resources.root_resource import RootResource from test.support.integration.model import MailBuilder from test.support.test_helper import request_mock @@ -73,9 +73,9 @@ class AppTestClient(object): self.mail_service = self._create_mail_service(self.mailboxes, self.mail_sender, self.soledad_querier, self.search_engine) self.search_engine.index_mails(self.mail_service.all_mails()) - self.app = App() - self.app.resource = RootResource() - self.app.resource.initialize(self.soledad_querier, self.keymanager, self.search_engine, self.mail_service, self.draft_service) + self.config = Config() + self.config.resource = RootResource() + self.config.resource.initialize(self.soledad_querier, self.keymanager, self.search_engine, self.mail_service, self.draft_service) def _render(self, request, as_json=True): def get_str(_str): @@ -86,7 +86,7 @@ class AppTestClient(object): if written_data: return get_str(written_data) - resource = getChildForRequest(self.app.resource, request) + resource = getChildForRequest(self.config.resource, request) result = resource.render(request) if isinstance(result, basestring): @@ -99,7 +99,7 @@ class AppTestClient(object): def run_on_a_thread(self, logfile='/tmp/app_test_client.log', port=4567, host='0.0.0.0'): def _start(): - reactor.listenTCP(port, Site(self.app.resource), interface=host) + reactor.listenTCP(port, Site(self.config.resource), interface=host) reactor.run() process = multiprocessing.Process(target=_start) process.start() diff --git a/service/test/unit/config/test_dispatcher.py b/service/test/unit/config/test_dispatcher.py index ad85a63c..8bb4bbc4 100644 --- a/service/test/unit/config/test_dispatcher.py +++ b/service/test/unit/config/test_dispatcher.py @@ -4,7 +4,7 @@ import thread import sys from mockito import mock, when import os -from pixelated.config import App +from pixelated.config.config import Config from pixelated.config.args import parse as parse_args from pixelated.config.dispatcher import config_dispatcher @@ -13,7 +13,7 @@ from pixelated.config.dispatcher import config_dispatcher class TestConfigDispatcher(unittest.TestCase): def setUp(self): - self.app = App() + self.config = Config() self.test_data = {'leap_provider_hostname': 'test_provider', 'user': 'test_user', 'password': 'test_password'} def test_that_organization_switch_reads_the_credentials_from_pipe(self): @@ -24,11 +24,11 @@ class TestConfigDispatcher(unittest.TestCase): self._mkfifo(fifo_path) - config_dispatcher(self.app, args) + provider, user, password = config_dispatcher(args.dispatcher) - self.assertEquals('test_provider', self.app['LEAP_SERVER_NAME']) - self.assertEquals('test_user', self.app['LEAP_USERNAME']) - self.assertEquals('test_password', self.app['LEAP_PASSWORD']) + self.assertEquals('test_provider', provider) + self.assertEquals('test_user', user) + self.assertEquals('test_password', password) def test_that_organization_switch_reads_the_credentials_from_stdin(self): data = json.dumps({'leap_provider_hostname': 'test_provider', 'user': 'test_user', 'password': 'test_password'}) @@ -40,11 +40,11 @@ class TestConfigDispatcher(unittest.TestCase): sys.argv = ['tmp/does_not_exist', '--dispatcher-stdin'] args = parse_args() - config_dispatcher(self.app, args) + provider, user, password = config_dispatcher(args.dispatcher) - self.assertEquals('test_provider', self.app['LEAP_SERVER_NAME']) - self.assertEquals('test_user', self.app['LEAP_USERNAME']) - self.assertEquals('test_password', self.app['LEAP_PASSWORD']) + self.assertEquals('test_provider', provider) + self.assertEquals('test_user', user) + self.assertEquals('test_password', password) finally: sys.stdin = orig_stdin |