GitHub PullRequestReviewCommentEvent at 2014-02-19 14:39:57
Repository: vumi-go
Actor: hodgestar
Payload: {"comment":{"url":"https://api.github.com/repos/praekelt/vumi-go/pulls/comments/9866376","id":9866376,"diff_hunk":"@@ -0,0 +1,124 @@\n+from go.base.tests.helpers import GoDjangoTestCase\n+from go.routers.tests.view_helpers import RouterViewsHelper\n+from go.vumitools.api import VumiApiCommand\n+\n+\n+class ApplicationMultiplexerViewTests(GoDjangoTestCase):\n+\n+    def setUp(self):\n+        self.router_helper = self.add_helper(\n+            RouterViewsHelper(u'application_multiplexer')\n+        )\n+        self.user_helper = self.router_helper.vumi_helper.get_or_create_user()\n+        self.client = self.router_helper.get_client()\n+\n+    def test_new_router(self):\n+        router_store = self.user_helper.user_api.router_store\n+        self.assertEqual([], router_store.list_routers())\n+\n+        response = self.client.post(self.router_helper.get_new_view_url(), {\n+            'name': u\"myrouter\",\n+            'router_type': u'application_multiplexer',\n+        })\n+        [router_key] = router_store.list_routers()\n+        rtr_helper = self.router_helper.get_router_helper_by_key(router_key)\n+        self.assertRedirects(response, rtr_helper.get_view_url('edit'))\n+\n+    def test_show_stopped(self):\n+        rtr_helper = self.router_helper.create_router_helper(name=u\"myrouter\")\n+        response = self.client.get(rtr_helper.get_view_url('show'))\n+        router = response.context[0].get('router')\n+        self.assertEqual(router.name, u\"myrouter\")\n+        self.assertContains(response, rtr_helper.get_view_url('start'))\n+        self.assertNotContains(response, rtr_helper.get_view_url('stop'))\n+\n+    def test_show_running(self):\n+        rtr_helper = self.router_helper.create_router_helper(\n+            name=u\"myrouter\", started=True)\n+        response = self.client.get(rtr_helper.get_view_url('show'))\n+        router = response.context[0].get('router')\n+        self.assertEqual(router.name, u\"myrouter\")\n+        self.assertNotContains(response, rtr_helper.get_view_url('start'))\n+        self.assertContains(response, rtr_helper.get_view_url('stop'))\n+\n+    def test_start(self):\n+        rtr_helper = self.router_helper.create_router_helper(started=False)\n+\n+        response = self.client.post(rtr_helper.get_view_url('start'))\n+        self.assertRedirects(response, rtr_helper.get_view_url('show'))\n+        router = rtr_helper.get_router()\n+        self.assertTrue(router.starting())\n+        [start_cmd] = self.router_helper.get_api_commands_sent()\n+        self.assertEqual(\n+            start_cmd, VumiApiCommand.command(\n+                '%s_router' % (router.router_type,), 'start',\n+                user_account_key=router.user_account.key,\n+                router_key=router.key))\n+\n+    def test_stop(self):\n+        rtr_helper = self.router_helper.create_router_helper(started=True)\n+\n+        response = self.client.post(rtr_helper.get_view_url('stop'))\n+        self.assertRedirects(response, rtr_helper.get_view_url('show'))\n+        router = rtr_helper.get_router()\n+        self.assertTrue(router.stopping())\n+        [start_cmd] = self.router_helper.get_api_commands_sent()\n+        self.assertEqual(\n+            start_cmd, VumiApiCommand.command(\n+                '%s_router' % (router.router_type,), 'stop',\n+                user_account_key=router.user_account.key,\n+                router_key=router.key))\n+\n+    def test_initial_config(self):\n+        rtr_helper = self.router_helper.create_router_helper(\n+            started=True, config={\n+                'menu_title': {'content': 'Please select an application'},\n+                'entries': [\n+                    {\n+                        'label': 'Flappy Bird',\n+                        'endpoint': 'flappy-bird',\n+","path":"go/routers/application_multiplexer/tests/test_views.py","position":80,"original_position":80,"commit_id":"e2894194c37b1630a3771dbeb509c18a42d46de9","original_commit_id":"e2894194c37b1630a3771dbeb509c18a42d46de9","user":{"login":"hodgestar","id":165551,"avatar_url":"https://gravatar.com/avatar/337cadae5be17c19e2defb615d7de9f8?d=https%3A%2F%2Fidenticons.github.com%2Fad0c17a89c56731630582f6a2b95c044.png&r=x","gravatar_id":"337cadae5be17c19e2defb615d7de9f8","url":"https://api.github.com/users/hodgestar","html_url":"https://github.com/hodgestar","followers_url":"https://api.github.com/users/hodgestar/followers","following_url":"https://api.github.com/users/hodgestar/following{/other_user}","gists_url":"https://api.github.com/users/hodgestar/gists{/gist_id}","starred_url":"https://api.github.com/users/hodgestar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hodgestar/subscriptions","organizations_url":"https://api.github.com/users/hodgestar/orgs","repos_url":"https://api.github.com/users/hodgestar/repos","events_url":"https://api.github.com/users/hodgestar/events{/privacy}","received_events_url":"https://api.github.com/users/hodgestar/received_events","type":"User","site_admin":false},"body":"Stray empty line.","created_at":"2014-02-19T14:39:57Z","updated_at":"2014-02-19T14:39:57Z","html_url":"https://github.com/praekelt/vumi-go/pull/844#discussion_r9866376","pull_request_url":"https://api.github.com/repos/praekelt/vumi-go/pulls/844","_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi-go/pulls/comments/9866376"},"html":{"href":"https://github.com/praekelt/vumi-go/pull/844#discussion_r9866376"},"pull_request":{"href":"https://api.github.com/repos/praekelt/vumi-go/pulls/844"}}}}