{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/solitude/pulls/comments/32259605","id":32259605,"diff_hunk":"@@ -88,37 +107,87 @@ def test_post_auth_fails(self):\n         self.req.post.return_value = self.get_response('', 403)\n         eq_(self.client.post(self.url, data=example()).status_code, 422)\n \n-    def test_post_ok(self):\n-        self.req.post.return_value = self.get_response('foo', 204)\n-        with patch('lib.brains.views.webhook.XmlUtil.dict_from_xml') as res:\n-            res.return_value = {\n-                'notification': {'kind': '', 'subject': subscription()}}\n-            with patch('lib.brains.views.webhook.Processor.process'):\n-                eq_(self.client.post(self.url, data=example()).status_code,\n-                    204)\n-\n \n-class SubscriptionTest(BraintreeTest):\n+@override_settings(BRAINTREE_PROXY='http://m.o')\n+class TestWebhookWithSubscription(SubscriptionTest):\n \n     def setUp(self):\n-        self.buyer, self.braintree_buyer = create_braintree_buyer()\n-        self.method = create_method(self.braintree_buyer)\n-        self.seller, self.seller_product = create_seller()\n-        self.braintree_sub = BraintreeSubscription.objects.create(\n-            paymethod=self.method,\n-            seller_product=self.seller_product,\n-            provider_id='some-bt:id'\n-        )\n-        self.sub = subscription(id='some-bt:id')\n+        super(TestWebhookWithSubscription, self).setUp()\n+        self.url = reverse('braintree:webhook')\n+        self.patch_webhook_forms()\n+        self.req.post.return_value = self.get_response('foo', 204)\n+\n+    def test_post_ok(self):\n+        with patch('lib.brains.views.webhook.XmlUtil.dict_from_xml') as attr:\n+            attr.return_value = {\n+                'notification': {\n+                    'kind': 'subscription_charged_successfully',\n+                    'subject': subscription()\n+                }\n+            }\n+            res = self.client.post(self.url, data=example())\n+            eq_(res.status_code, 200)\n+            eq_(res.json.keys(), ['mozilla', 'braintree'])\n+\n+    def test_post_ignored(self):\n+        with patch('lib.brains.views.webhook.XmlUtil.dict_from_xml') as attr:\n+            attr.return_value = {\n+                'notification': {\n+                    'kind': '',\n+                    'subject': ''\n+                }\n+            }\n+            res = self.client.post(self.url, data=example())\n+            eq_(res.status_code, 204)\n \n \n class TestSubscription(SubscriptionTest):\n+    kind = 'subscription_charged_successfully'\n \n     def process(self, subscription):\n         process = Processor(notification(subject=subscription))\n         process.update_transactions(process.webhook.subscription,\n                                     self.braintree_sub)\n \n+    def test_data(self):\n+        process = Processor(notification(\n+            subject=subscription(), kind=self.kind))\n+        process.process()","path":"lib/brains/tests/test_webhook.py","position":108,"original_position":108,"commit_id":"fc325c4dd3d74712cedff3175c4ec3eb27c4c3d6","original_commit_id":"fc325c4dd3d74712cedff3175c4ec3eb27c4c3d6","user":{"login":"andymckay","id":74699,"avatar_url":"https://avatars.githubusercontent.com/u/74699?v=3","gravatar_id":"","url":"https://api.github.com/users/andymckay","html_url":"https://github.com/andymckay","followers_url":"https://api.github.com/users/andymckay/followers","following_url":"https://api.github.com/users/andymckay/following{/other_user}","gists_url":"https://api.github.com/users/andymckay/gists{/gist_id}","starred_url":"https://api.github.com/users/andymckay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andymckay/subscriptions","organizations_url":"https://api.github.com/users/andymckay/orgs","repos_url":"https://api.github.com/users/andymckay/repos","events_url":"https://api.github.com/users/andymckay/events{/privacy}","received_events_url":"https://api.github.com/users/andymckay/received_events","type":"User","site_admin":false},"body":"yeah i probably can...","created_at":"2015-06-11T19:42:52Z","updated_at":"2015-06-11T19:42:52Z","html_url":"https://github.com/mozilla/solitude/pull/472#discussion_r32259605","pull_request_url":"https://api.github.com/repos/mozilla/solitude/pulls/472","_links":{"self":{"href":"https://api.github.com/repos/mozilla/solitude/pulls/comments/32259605"},"html":{"href":"https://github.com/mozilla/solitude/pull/472#discussion_r32259605"},"pull_request":{"href":"https://api.github.com/repos/mozilla/solitude/pulls/472"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/solitude/pulls/472","id":37322705,"html_url":"https://github.com/mozilla/solitude/pull/472","diff_url":"https://github.com/mozilla/solitude/pull/472.diff","patch_url":"https://github.com/mozilla/solitude/pull/472.patch","issue_url":"https://api.github.com/repos/mozilla/solitude/issues/472","number":472,"state":"open","locked":false,"title":"return something on webhooks","user":{"login":"andymckay","id":74699,"avatar_url":"https://avatars.githubusercontent.com/u/74699?v=3","gravatar_id":"","url":"https://api.github.com/users/andymckay","html_url":"https://github.com/andymckay","followers_url":"https://api.github.com/users/andymckay/followers","following_url":"https://api.github.com/users/andymckay/following{/other_user}","gists_url":"https://api.github.com/users/andymckay/gists{/gist_id}","starred_url":"https://api.github.com/users/andymckay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andymckay/subscriptions","organizations_url":"https://api.github.com/users/andymckay/orgs","repos_url":"https://api.github.com/users/andymckay/repos","events_url":"https://api.github.com/users/andymckay/events{/privacy}","received_events_url":"https://api.github.com/users/andymckay/received_events","type":"User","site_admin":false},"body":"looking for feedback, concerned about the link between transactions and subscription, as mentioned in the comments","created_at":"2015-06-10T04:09:23Z","updated_at":"2015-06-11T19:42:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2dff311254074ca838afbdc70a2ba1c3c34343a8","assignee":{"login":"kumar303","id":55398,"avatar_url":"https://avatars.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/solitude/pulls/472/commits","review_comments_url":"https://api.github.com/repos/mozilla/solitude/pulls/472/comments","review_comment_url":"https://api.github.com/repos/mozilla/solitude/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/solitude/issues/472/comments","statuses_url":"https://api.github.com/repos/mozilla/solitude/statuses/fc325c4dd3d74712cedff3175c4ec3eb27c4c3d6","head":{"label":"andymckay:webhook-return","ref":"webhook-return","sha":"fc325c4dd3d74712cedff3175c4ec3eb27c4c3d6","user":{"login":"andymckay","id":74699,"avatar_url":"https://avatars.githubusercontent.com/u/74699?v=3","gravatar_id":"","url":"https://api.github.com/users/andymckay","html_url":"https://github.com/andymckay","followers_url":"https://api.github.com/users/andymckay/followers","following_url":"https://api.github.com/users/andymckay/following{/other_user}","gists_url":"https://api.github.com/users/andymckay/gists{/gist_id}","starred_url":"https://api.github.com/users/andymckay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andymckay/subscriptions","organizations_url":"https://api.github.com/users/andymckay/orgs","repos_url":"https://api.github.com/users/andymckay/repos","events_url":"https://api.github.com/users/andymckay/events{/privacy}","received_events_url":"https://api.github.com/users/andymckay/received_events","type":"User","site_admin":false},"repo":{"id":23588659,"name":"solitude","full_name":"andymckay/solitude","owner":{"login":"andymckay","id":74699,"avatar_url":"https://avatars.githubusercontent.com/u/74699?v=3","gravatar_id":"","url":"https://api.github.com/users/andymckay","html_url":"https://github.com/andymckay","followers_url":"https://api.github.com/users/andymckay/followers","following_url":"https://api.github.com/users/andymckay/following{/other_user}","gists_url":"https://api.github.com/users/andymckay/gists{/gist_id}","starred_url":"https://api.github.com/users/andymckay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andymckay/subscriptions","organizations_url":"https://api.github.com/users/andymckay/orgs","repos_url":"https://api.github.com/users/andymckay/repos","events_url":"https://api.github.com/users/andymckay/events{/privacy}","received_events_url":"https://api.github.com/users/andymckay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andymckay/solitude","description":"A server for processing payments for Mozilla’s Marketplace and Add-ons site.","fork":true,"url":"https://api.github.com/repos/andymckay/solitude","forks_url":"https://api.github.com/repos/andymckay/solitude/forks","keys_url":"https://api.github.com/repos/andymckay/solitude/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andymckay/solitude/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andymckay/solitude/teams","hooks_url":"https://api.github.com/repos/andymckay/solitude/hooks","issue_events_url":"https://api.github.com/repos/andymckay/solitude/issues/events{/number}","events_url":"https://api.github.com/repos/andymckay/solitude/events","assignees_url":"https://api.github.com/repos/andymckay/solitude/assignees{/user}","branches_url":"https://api.github.com/repos/andymckay/solitude/branches{/branch}","tags_url":"https://api.github.com/repos/andymckay/solitude/tags","blobs_url":"https://api.github.com/repos/andymckay/solitude/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andymckay/solitude/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andymckay/solitude/git/refs{/sha}","trees_url":"https://api.github.com/repos/andymckay/solitude/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andymckay/solitude/statuses/{sha}","languages_url":"https://api.github.com/repos/andymckay/solitude/languages","stargazers_url":"https://api.github.com/repos/andymckay/solitude/stargazers","contributors_url":"https://api.github.com/repos/andymckay/solitude/contributors","subscribers_url":"https://api.github.com/repos/andymckay/solitude/subscribers","subscription_url":"https://api.github.com/repos/andymckay/solitude/subscription","commits_url":"https://api.github.com/repos/andymckay/solitude/commits{/sha}","git_commits_url":"https://api.github.com/repos/andymckay/solitude/git/commits{/sha}","comments_url":"https://api.github.com/repos/andymckay/solitude/comments{/number}","issue_comment_url":"https://api.github.com/repos/andymckay/solitude/issues/comments{/number}","contents_url":"https://api.github.com/repos/andymckay/solitude/contents/{+path}","compare_url":"https://api.github.com/repos/andymckay/solitude/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andymckay/solitude/merges","archive_url":"https://api.github.com/repos/andymckay/solitude/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andymckay/solitude/downloads","issues_url":"https://api.github.com/repos/andymckay/solitude/issues{/number}","pulls_url":"https://api.github.com/repos/andymckay/solitude/pulls{/number}","milestones_url":"https://api.github.com/repos/andymckay/solitude/milestones{/number}","notifications_url":"https://api.github.com/repos/andymckay/solitude/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andymckay/solitude/labels{/name}","releases_url":"https://api.github.com/repos/andymckay/solitude/releases{/id}","created_at":"2014-09-02T17:37:20Z","updated_at":"2015-04-19T15:06:31Z","pushed_at":"2015-06-11T18:21:40Z","git_url":"git://github.com/andymckay/solitude.git","ssh_url":"git@github.com:andymckay/solitude.git","clone_url":"https://github.com/andymckay/solitude.git","svn_url":"https://github.com/andymckay/solitude","homepage":"http://readthedocs.org/docs/solitude/en/latest/","size":4287,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"7c7fcfe095852ba66e845c91fac7a95c9fc4b547","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":4566171,"name":"solitude","full_name":"mozilla/solitude","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/solitude","description":"A server for processing payments for Mozilla’s Marketplace.","fork":false,"url":"https://api.github.com/repos/mozilla/solitude","forks_url":"https://api.github.com/repos/mozilla/solitude/forks","keys_url":"https://api.github.com/repos/mozilla/solitude/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/solitude/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/solitude/teams","hooks_url":"https://api.github.com/repos/mozilla/solitude/hooks","issue_events_url":"https://api.github.com/repos/mozilla/solitude/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/solitude/events","assignees_url":"https://api.github.com/repos/mozilla/solitude/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/solitude/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/solitude/tags","blobs_url":"https://api.github.com/repos/mozilla/solitude/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/solitude/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/solitude/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/solitude/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/solitude/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/solitude/languages","stargazers_url":"https://api.github.com/repos/mozilla/solitude/stargazers","contributors_url":"https://api.github.com/repos/mozilla/solitude/contributors","subscribers_url":"https://api.github.com/repos/mozilla/solitude/subscribers","subscription_url":"https://api.github.com/repos/mozilla/solitude/subscription","commits_url":"https://api.github.com/repos/mozilla/solitude/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/solitude/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/solitude/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/solitude/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/solitude/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/solitude/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/solitude/merges","archive_url":"https://api.github.com/repos/mozilla/solitude/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/solitude/downloads","issues_url":"https://api.github.com/repos/mozilla/solitude/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/solitude/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/solitude/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/solitude/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/solitude/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/solitude/releases{/id}","created_at":"2012-06-05T22:13:53Z","updated_at":"2015-06-09T07:07:03Z","pushed_at":"2015-06-11T18:23:03Z","git_url":"git://github.com/mozilla/solitude.git","ssh_url":"git@github.com:mozilla/solitude.git","clone_url":"https://github.com/mozilla/solitude.git","svn_url":"https://github.com/mozilla/solitude","homepage":"http://readthedocs.org/docs/solitude/en/latest/","size":6904,"stargazers_count":25,"watchers_count":25,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":19,"forks":28,"open_issues":19,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/solitude/pulls/472"},"html":{"href":"https://github.com/mozilla/solitude/pull/472"},"issue":{"href":"https://api.github.com/repos/mozilla/solitude/issues/472"},"comments":{"href":"https://api.github.com/repos/mozilla/solitude/issues/472/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/solitude/pulls/472/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/solitude/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/solitude/pulls/472/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/solitude/statuses/fc325c4dd3d74712cedff3175c4ec3eb27c4c3d6"}}}}