From 75178a8e7fdedbee38dc9dd746e5c99e8e3669bb Mon Sep 17 00:00:00 2001 From: BenjamenMeyer Date: Wed, 11 Feb 2015 20:30:47 +0000 Subject: [PATCH] Pep8 Compliance per TravisCI --- stackinabox/services/service.py | 8 ++++++-- stackinabox/test/test_advanced.py | 24 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/stackinabox/services/service.py b/stackinabox/services/service.py index 0d106a0..bca08ab 100644 --- a/stackinabox/services/service.py +++ b/stackinabox/services/service.py @@ -84,7 +84,8 @@ def request(self, method, request, uri, headers): 'removing for match operation.' .format(self.__id, self.name)) uri_path, uri_qs = uri.split('?') - logger.debug('StackInABoxService ({0}:{1}): uri = "{2}", query = "{3}"' + logger.debug('StackInABoxService ({0}:{1}): uri = "{2}", ' + 'query = "{3}"' .format(self.__id, self.name, uri_path, uri_qs)) for k, v in self.routes.items(): @@ -104,7 +105,10 @@ def request(self, method, request, uri, headers): if method in v['handlers']: logger.debug('StackInABoxService ({0}:{1}): Calling ' 'handler for route {2} on method {3}...' - .format(self.__id, self.name, v['uri'], method)) + .format(self.__id, + self.name, + v['uri'], + method)) return v['handlers'][method](self, request, uri, diff --git a/stackinabox/test/test_advanced.py b/stackinabox/test/test_advanced.py index 430f130..8139fce 100644 --- a/stackinabox/test/test_advanced.py +++ b/stackinabox/test/test_advanced.py @@ -22,9 +22,12 @@ class AdvancedService(StackInABoxService): def __init__(self): super(AdvancedService, self).__init__('advanced') - self.register(StackInABoxService.GET, '/', AdvancedService.handler) - self.register(StackInABoxService.GET, '/h', AdvancedService.alternate_handler) - self.register(StackInABoxService.GET, '/g', AdvancedService.query_handler) + self.register(StackInABoxService.GET, '/', + AdvancedService.handler) + self.register(StackInABoxService.GET, '/h', + AdvancedService.alternate_handler) + self.register(StackInABoxService.GET, '/g', + AdvancedService.query_handler) def handler(self, request, uri, headers): return (200, headers, 'Hello') @@ -79,7 +82,8 @@ def test_basic(self): 'alice': 'alice: Good-Bye bob', 'joe': 'joe: Good-Bye jane' } - res = requests.get('http://localhost/advanced/g?bob=alice;alice=bob&joe=jane') + res = requests.get('http://localhost/advanced/g?bob=alice;' + 'alice=bob&joe=jane') self.assertEqual(res.status_code, 200) self.assertEqual(res.json(), expected_result) @@ -87,9 +91,11 @@ def test_basic(self): def tb_responses_setup(): StackInABox.register_service(AdvancedService()) + def tb_responses_teardown(): StackInABox.reset_services() + @responses.activate def tb_basic_responses(): stackinabox.util_responses.responses_registration('localhost') @@ -107,10 +113,12 @@ def tb_basic_responses(): 'alice': 'alice: Good-Bye bob', 'joe': 'joe: Good-Bye jane' } - res = requests.get('http://localhost/advanced/g?bob=alice;alice=bob&joe=jane') + res = requests.get('http://localhost/advanced/g?bob=alice;' + 'alice=bob&joe=jane') assert res.status_code == 200 assert res.json() == expected_result -test_basic_responses = unittest.FunctionTestCase(tb_basic_responses, - setUp=tb_responses_setup, - tearDown=tb_responses_teardown) +test_basic_responses = \ + unittest.FunctionTestCase(tb_basic_responses, + setUp=tb_responses_setup, + tearDown=tb_responses_teardown)