Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Various minor cleanups as per review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Geddes committed Feb 25, 2014
1 parent 45f53b4 commit e3b47bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
12 changes: 2 additions & 10 deletions go/routers/app_multiplexer/tests/test_vumi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def raise_error(*args, **kw):

class TestApplicationMultiplexerRouter(VumiTestCase):

router_class = ApplicationMultiplexer

ROUTER_CONFIG = {
'invalid_input_message': 'Bad choice.\n1) Try Again',
'error_message': 'Oops! Sorry!',
Expand Down Expand Up @@ -51,11 +49,6 @@ def assert_session_state(self, user_id, expected_session):
self.assertEqual(session, expected_session,
msg="Unexpected session data")

def dynamic_config(self, fields):
config = self.router_worker.config.copy()
config.update(fields)
return config

@inlineCallbacks
def assert_routed_inbound(self, content, router, expected_endpoint):
msg = yield self.router_helper.ri.make_dispatch_inbound(
Expand Down Expand Up @@ -421,7 +414,7 @@ def test_get_menu_choice(self):
self.assertEqual(choice, None)

def test_create_menu(self):
config = self.dynamic_config({
router_worker = yield self.router_helper.get_router_worker({
'menu_title': {'content': 'Please select a choice'},
'entries': [
{
Expand All @@ -434,8 +427,7 @@ def test_create_menu(self):
}
]
})
config = self.router_worker.CONFIG_CLASS(config)
text = self.router_worker.create_menu(config)
text = router_worker.create_menu(self.router_worker.config)
self.assertEqual(
text,
'Please select a choice\n1) Flappy Bird\n2) Mama'
Expand Down
4 changes: 2 additions & 2 deletions go/routers/app_multiplexer/view_definition.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from go.router.view_definition import RouterViewDefinitionBase, EditRouterView

from go.routers.app_multiplexer.forms import \
(ApplicationMultiplexerTitleForm, ApplicationMultiplexerFormSet)
from go.routers.app_multiplexer.forms import (ApplicationMultiplexerTitleForm,
ApplicationMultiplexerFormSet)


class EditApplicationMultiplexerView(EditRouterView):
Expand Down
4 changes: 2 additions & 2 deletions go/routers/app_multiplexer/vumi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def handle_outbound(self, config, msg, conn_name):
@inlineCallbacks
def handle_session_close(self, config, session, msg):
user_id = msg['from_addr']
if session.get('state', None) == self.STATE_SELECTED and \
session['active_endpoint'] in self.target_endpoints(config):
if (session.get('state', None) == self.STATE_SELECTED and
session['active_endpoint'] in self.target_endpoints(config)):
yield self.publish_inbound(
self.forwarded_message(
msg, content=None,
Expand Down

0 comments on commit e3b47bf

Please sign in to comment.