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

Commit

Permalink
Add help template to http_api_nostream edit view and test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed Jun 17, 2015
1 parent 176fcca commit 6a07bc9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions go/apps/http_api_nostream/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,34 @@ def test_get_edit_view_no_config(self):
self.assertEqual(conversation.config, {})
response = self.client.get(conv_helper.get_view_url('edit'))
self.assertEqual(response.status_code, 200)

def test_get_edit_view_help(self):
conv_helper = self.app_helper.create_conversation_helper({
'http_api_nostream': {
'api_tokens': ['token1234'],
},
})
conversation = conv_helper.get_conversation()
self.assertEqual(conversation.config, {})
response = self.client.get(conv_helper.get_view_url('edit'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, "\n".join([
" $ curl -X PUT \\",
" --user 'test-0-user:' \\",
" --data '{\"in_reply_to\": "
"\"59b37288d8d94e42ab804158bdbf53e5\", \\",
" \"to_addr\": \"27761234567\", \\",
" \"to_addr_type\": \"msisdn\", \\",
" \"content\": \"This is an outgoing SMS!\"}' \\",
" https://go.vumi.org/api/v1/go/http_api_nostream/%s/"
"messages.json \\",
" -vvv",
]) % conversation.key)
self.assertContains(response, "\n".join([
" $ curl -X PUT \\",
" --user 'test-0-user:' \\",
" --data '[[\"total_pings\", 1200, \"MAX\"]]' \\",
" https://go.vumi.org/api/v1/go/http_api_nostream/%s/"
"metrics.json \\",
" -vvv",
]) % conversation.key)
1 change: 1 addition & 0 deletions go/apps/http_api_nostream/view_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class EditHttpApiNoStreamView(EditConversationView):
edit_forms = (
('http_api_nostream', TokenForm),
)
help_template = 'http_api_nostream/edit_help.html'


class ConversationViewDefinition(ConversationViewDefinitionBase):
Expand Down

0 comments on commit 6a07bc9

Please sign in to comment.