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

Commit

Permalink
Correctly display and test API token examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed Jun 18, 2015
1 parent 97b2526 commit bd11952
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1>Example send</h1>

<pre><code>
$ curl -X PUT \
--user '{{ conversation.user_account.key }}:{{ conversation.get_config.http_api_nostream.api_tokens }}' \
--user '{{ conversation.user_account.key }}:{{ conversation.get_config.http_api_nostream.api_tokens | first }}' \
--data '{"in_reply_to": "59b37288d8d94e42ab804158bdbf53e5", \
"to_addr": "27761234567", \
"to_addr_type": "msisdn", \
Expand All @@ -19,7 +19,7 @@ <h1>Example metric firing</h1>

<pre><code>
$ curl -X PUT \
--user '{{ conversation.user_account.key }}:{{ conversation.get_config.http_api_nostream.api_tokens }}' \
--user '{{ conversation.user_account.key }}:{{ conversation.get_config.http_api_nostream.api_tokens | first }}' \
--data '[["total_pings", 1200, "MAX"]]' \
https://go.vumi.org/api/v1/go/http_api_nostream/{{ conversation.key }}/metrics.json \
-vvv
Expand Down
7 changes: 3 additions & 4 deletions go/apps/http_api_nostream/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,17 @@ def test_get_edit_view_no_config(self):
self.assertEqual(response.status_code, 200)

def test_get_edit_view_help(self):
conv_helper = self.app_helper.create_conversation_helper({
conv_helper = self.app_helper.create_conversation_helper(config={
'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:' \\",
" --user 'test-0-user:token1234' \\",
" --data '{\"in_reply_to\": "
"\"59b37288d8d94e42ab804158bdbf53e5\", \\",
" \"to_addr\": \"27761234567\", \\",
Expand All @@ -217,7 +216,7 @@ def test_get_edit_view_help(self):
]) % conversation.key)
self.assertContains(response, "\n".join([
" $ curl -X PUT \\",
" --user 'test-0-user:' \\",
" --user 'test-0-user:token1234' \\",
" --data '[[\"total_pings\", 1200, \"MAX\"]]' \\",
" https://go.vumi.org/api/v1/go/http_api_nostream/%s/"
"metrics.json \\",
Expand Down

0 comments on commit bd11952

Please sign in to comment.