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

Commit

Permalink
Better log warning for bad http_api_nostream config.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerith committed Dec 6, 2013
1 parent 9a1558b commit b348ee6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions go/apps/http_api_nostream/tests/test_vumi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ def test_post_inbound_message_no_url(self):
yield self.conversation.save()

msg = self.msg_helper.make_inbound('in 1', message_id='1')
with LogCatcher(message='URL not configured') as lc:
with LogCatcher(message='push_message_url not configured') as lc:
yield self.dispatch_to_conv(msg, self.conversation)
[url_not_configured_log] = lc.messages()
self.assertTrue('push_message_url' in url_not_configured_log)
self.assertTrue(self.conversation.key in url_not_configured_log)

@inlineCallbacks
def test_post_inbound_message_unsupported_scheme(self):
Expand Down Expand Up @@ -457,10 +457,10 @@ def test_post_inbound_event_no_url(self):
msg1 = yield self.msg_helper.make_stored_outbound(
self.conversation, 'out 1', message_id='1')
ack1 = self.msg_helper.make_ack(msg1)
with LogCatcher(message='URL not configured') as lc:
with LogCatcher(message='push_event_url not configured') as lc:
yield self.dispatch_event_to_conv(ack1, self.conversation)
[url_not_configured_log] = lc.messages()
self.assertTrue('push_event_url' in url_not_configured_log)
self.assertTrue(self.conversation.key in url_not_configured_log)

@inlineCallbacks
def test_post_inbound_event_timeout(self):
Expand Down
8 changes: 6 additions & 2 deletions go/apps/http_api_nostream/vumi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def consume_user_message(self, message):
push_message_url = self.get_api_config(conversation,
'push_message_url')
if push_message_url is None:
log.warning("URL not configured: push_message_url")
log.warning(
"push_message_url not configured for conversation: %s" % (
conversation.key))
return
yield self.push(push_message_url, message)

Expand All @@ -93,7 +95,9 @@ def consume_unknown_event(self, event):
conversation = config.get_conversation()
push_event_url = self.get_api_config(conversation, 'push_event_url')
if push_event_url is None:
log.warning("URL not configured: push_event_url")
log.warning(
"push_event_url not configured for conversation: %s" % (
conversation.key))
return
yield self.push(push_event_url, event)

Expand Down

0 comments on commit b348ee6

Please sign in to comment.