{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/airmozilla/pulls/comments/36238758","id":36238758,"diff_hunk":"@@ -0,0 +1,86 @@\n+from cStringIO import StringIO\n+import mock\n+from mock import Mock\n+\n+from airmozilla.base.tests.testbase import DjangoTestCase\n+from airmozilla.main.models import Event\n+from airmozilla.manage.tests.views.test_vidlymedia import (\n+    SAMPLE_MEDIA_SUBMITTED_XML,\n+)\n+from airmozilla.popcorn.renderer import render_edit\n+from airmozilla.popcorn.models import PopcornEdit\n+\n+\n+class TestPopcornRender(DjangoTestCase):\n+    fixtures = ['airmozilla/manage/tests/main_testdata.json']\n+    main_image = 'airmozilla/manage/tests/firefox.png'\n+\n+    def setUp(self):\n+        super(TestPopcornRender, self).setUp()\n+\n+        # The event we're going to clone needs to have a real image\n+        # associated with it so it can be rendered.\n+        event = Event.objects.get(title='Test event')\n+        self._attach_file(event, self.main_image)\n+\n+    @mock.patch('airmozilla.manage.vidly.urllib2')\n+    @mock.patch('airmozilla.popcorn.renderer.Key')\n+    @mock.patch('boto.connect_s3')\n+    @mock.patch('airmozilla.popcorn.renderer.process_json')\n+    def test_render(self, p_process_json, p_connect_s3, p_key, p_urllib2):\n+        def make_mock_request(url, querystring):\n+            return mock.MagicMock()\n+\n+        def mocked_urlopen(request):\n+            xml_string = SAMPLE_MEDIA_SUBMITTED_XML\n+            return StringIO(xml_string)\n+\n+        def process_json_mock(data, out, background_color='#000000'):\n+            with open(out, 'w') as f:\n+                f.write('')\n+\n+        def generate_key_mock():\n+            def mock_generate_url(expires_in=0, query_auth=False):\n+                return 'foo'\n+\n+            key_mock = Mock()\n+            key_mock.generate_url.side_effect = mock_generate_url\n+            return key_mock\n+\n+        def get_bucket_mock(name):\n+            m_bucket = Mock()\n+            m_bucket.name = name\n+            return m_bucket\n+\n+        def make_mock_key(bucket):\n+            def set_contents_mock(filename):\n+                return\n+\n+            def generate_url_mock(expires_in, query_auth):\n+                return 'https://example.com'\n+\n+            mocked_key = Mock()\n+            mocked_key.set_contents_from_filename.side_effect = \\\n+                set_contents_mock\n+            mocked_key.generate_url.side_effect = generate_url_mock\n+            return mocked_key\n+\n+        p_key.side_effect = make_mock_key\n+\n+        p_urllib2.Request.side_effect = make_mock_request\n+        p_urllib2.urlopen = mocked_urlopen\n+\n+        p_process_json.side_effect = process_json_mock\n+        p_connect_s3().get_bucket.side_effect = get_bucket_mock\n+        p_key.side_effect = make_mock_key\n+\n+        event = Event.objects.get(title='Test event')\n+\n+        edit = PopcornEdit.objects.create(\n+            event=event,\n+            status=PopcornEdit.STATUS_PENDING,\n+            data={},\n+            user=event.creator,\n+        )\n+\n+        render_edit(edit.id)","path":"airmozilla/popcorn/tests/test_renderer.py","position":86,"original_position":86,"commit_id":"5f9cf48658ea382b189fe91ef39d520bb19015a8","original_commit_id":"5f9cf48658ea382b189fe91ef39d520bb19015a8","user":{"login":"peterbe","id":26739,"avatar_url":"https://avatars.githubusercontent.com/u/26739?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"body":"No checking afterwards? Like checking that there is now a vidly submission etc?","created_at":"2015-08-04T20:40:58Z","updated_at":"2015-08-04T20:40:58Z","html_url":"https://github.com/mozilla/airmozilla/pull/415#discussion_r36238758","pull_request_url":"https://api.github.com/repos/mozilla/airmozilla/pulls/415","_links":{"self":{"href":"https://api.github.com/repos/mozilla/airmozilla/pulls/comments/36238758"},"html":{"href":"https://github.com/mozilla/airmozilla/pull/415#discussion_r36238758"},"pull_request":{"href":"https://api.github.com/repos/mozilla/airmozilla/pulls/415"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/airmozilla/pulls/415","id":41410791,"html_url":"https://github.com/mozilla/airmozilla/pull/415","diff_url":"https://github.com/mozilla/airmozilla/pull/415.diff","patch_url":"https://github.com/mozilla/airmozilla/pull/415.patch","issue_url":"https://api.github.com/repos/mozilla/airmozilla/issues/415","number":415,"state":"open","locked":false,"title":"Popcoder integration","user":{"login":"Nolski","id":2600677,"avatar_url":"https://avatars.githubusercontent.com/u/2600677?v=3","gravatar_id":"","url":"https://api.github.com/users/Nolski","html_url":"https://github.com/Nolski","followers_url":"https://api.github.com/users/Nolski/followers","following_url":"https://api.github.com/users/Nolski/following{/other_user}","gists_url":"https://api.github.com/users/Nolski/gists{/gist_id}","starred_url":"https://api.github.com/users/Nolski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nolski/subscriptions","organizations_url":"https://api.github.com/users/Nolski/orgs","repos_url":"https://api.github.com/users/Nolski/repos","events_url":"https://api.github.com/users/Nolski/events{/privacy}","received_events_url":"https://api.github.com/users/Nolski/received_events","type":"User","site_admin":false},"body":"This includes:\r\n- Code for running a cronjob which will render the first of all video submissions\r\n- Webhook for updating our database when Vidly finishes rendering our new video\r\n- Tests for the webhook.","created_at":"2015-08-02T01:36:12Z","updated_at":"2015-08-04T20:40:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c194d972447a19e2e5a2e06b007f66a488199614","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/airmozilla/pulls/415/commits","review_comments_url":"https://api.github.com/repos/mozilla/airmozilla/pulls/415/comments","review_comment_url":"https://api.github.com/repos/mozilla/airmozilla/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/airmozilla/issues/415/comments","statuses_url":"https://api.github.com/repos/mozilla/airmozilla/statuses/5f9cf48658ea382b189fe91ef39d520bb19015a8","head":{"label":"Nolski:popcoder-integration","ref":"popcoder-integration","sha":"5f9cf48658ea382b189fe91ef39d520bb19015a8","user":{"login":"Nolski","id":2600677,"avatar_url":"https://avatars.githubusercontent.com/u/2600677?v=3","gravatar_id":"","url":"https://api.github.com/users/Nolski","html_url":"https://github.com/Nolski","followers_url":"https://api.github.com/users/Nolski/followers","following_url":"https://api.github.com/users/Nolski/following{/other_user}","gists_url":"https://api.github.com/users/Nolski/gists{/gist_id}","starred_url":"https://api.github.com/users/Nolski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nolski/subscriptions","organizations_url":"https://api.github.com/users/Nolski/orgs","repos_url":"https://api.github.com/users/Nolski/repos","events_url":"https://api.github.com/users/Nolski/events{/privacy}","received_events_url":"https://api.github.com/users/Nolski/received_events","type":"User","site_admin":false},"repo":{"id":36747435,"name":"airmozilla","full_name":"Nolski/airmozilla","owner":{"login":"Nolski","id":2600677,"avatar_url":"https://avatars.githubusercontent.com/u/2600677?v=3","gravatar_id":"","url":"https://api.github.com/users/Nolski","html_url":"https://github.com/Nolski","followers_url":"https://api.github.com/users/Nolski/followers","following_url":"https://api.github.com/users/Nolski/following{/other_user}","gists_url":"https://api.github.com/users/Nolski/gists{/gist_id}","starred_url":"https://api.github.com/users/Nolski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nolski/subscriptions","organizations_url":"https://api.github.com/users/Nolski/orgs","repos_url":"https://api.github.com/users/Nolski/repos","events_url":"https://api.github.com/users/Nolski/events{/privacy}","received_events_url":"https://api.github.com/users/Nolski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nolski/airmozilla","description":"AirMozilla is the video broadcasting site for the Mozilla project","fork":true,"url":"https://api.github.com/repos/Nolski/airmozilla","forks_url":"https://api.github.com/repos/Nolski/airmozilla/forks","keys_url":"https://api.github.com/repos/Nolski/airmozilla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nolski/airmozilla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nolski/airmozilla/teams","hooks_url":"https://api.github.com/repos/Nolski/airmozilla/hooks","issue_events_url":"https://api.github.com/repos/Nolski/airmozilla/issues/events{/number}","events_url":"https://api.github.com/repos/Nolski/airmozilla/events","assignees_url":"https://api.github.com/repos/Nolski/airmozilla/assignees{/user}","branches_url":"https://api.github.com/repos/Nolski/airmozilla/branches{/branch}","tags_url":"https://api.github.com/repos/Nolski/airmozilla/tags","blobs_url":"https://api.github.com/repos/Nolski/airmozilla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nolski/airmozilla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nolski/airmozilla/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nolski/airmozilla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nolski/airmozilla/statuses/{sha}","languages_url":"https://api.github.com/repos/Nolski/airmozilla/languages","stargazers_url":"https://api.github.com/repos/Nolski/airmozilla/stargazers","contributors_url":"https://api.github.com/repos/Nolski/airmozilla/contributors","subscribers_url":"https://api.github.com/repos/Nolski/airmozilla/subscribers","subscription_url":"https://api.github.com/repos/Nolski/airmozilla/subscription","commits_url":"https://api.github.com/repos/Nolski/airmozilla/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nolski/airmozilla/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nolski/airmozilla/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nolski/airmozilla/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nolski/airmozilla/contents/{+path}","compare_url":"https://api.github.com/repos/Nolski/airmozilla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nolski/airmozilla/merges","archive_url":"https://api.github.com/repos/Nolski/airmozilla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nolski/airmozilla/downloads","issues_url":"https://api.github.com/repos/Nolski/airmozilla/issues{/number}","pulls_url":"https://api.github.com/repos/Nolski/airmozilla/pulls{/number}","milestones_url":"https://api.github.com/repos/Nolski/airmozilla/milestones{/number}","notifications_url":"https://api.github.com/repos/Nolski/airmozilla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nolski/airmozilla/labels{/name}","releases_url":"https://api.github.com/repos/Nolski/airmozilla/releases{/id}","created_at":"2015-06-02T16:48:55Z","updated_at":"2015-06-02T16:48:57Z","pushed_at":"2015-08-04T20:22:54Z","git_url":"git://github.com/Nolski/airmozilla.git","ssh_url":"git@github.com:Nolski/airmozilla.git","clone_url":"https://github.com/Nolski/airmozilla.git","svn_url":"https://github.com/Nolski/airmozilla","homepage":"https://air.mozilla.org","size":14915,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"04f9faabc7869d99c4a4409a4b8aadb4135d8a0c","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":4588705,"name":"airmozilla","full_name":"mozilla/airmozilla","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/airmozilla","description":"AirMozilla is the video broadcasting site for the Mozilla project","fork":false,"url":"https://api.github.com/repos/mozilla/airmozilla","forks_url":"https://api.github.com/repos/mozilla/airmozilla/forks","keys_url":"https://api.github.com/repos/mozilla/airmozilla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/airmozilla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/airmozilla/teams","hooks_url":"https://api.github.com/repos/mozilla/airmozilla/hooks","issue_events_url":"https://api.github.com/repos/mozilla/airmozilla/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/airmozilla/events","assignees_url":"https://api.github.com/repos/mozilla/airmozilla/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/airmozilla/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/airmozilla/tags","blobs_url":"https://api.github.com/repos/mozilla/airmozilla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/airmozilla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/airmozilla/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/airmozilla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/airmozilla/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/airmozilla/languages","stargazers_url":"https://api.github.com/repos/mozilla/airmozilla/stargazers","contributors_url":"https://api.github.com/repos/mozilla/airmozilla/contributors","subscribers_url":"https://api.github.com/repos/mozilla/airmozilla/subscribers","subscription_url":"https://api.github.com/repos/mozilla/airmozilla/subscription","commits_url":"https://api.github.com/repos/mozilla/airmozilla/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/airmozilla/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/airmozilla/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/airmozilla/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/airmozilla/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/airmozilla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/airmozilla/merges","archive_url":"https://api.github.com/repos/mozilla/airmozilla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/airmozilla/downloads","issues_url":"https://api.github.com/repos/mozilla/airmozilla/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/airmozilla/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/airmozilla/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/airmozilla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/airmozilla/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/airmozilla/releases{/id}","created_at":"2012-06-07T18:19:43Z","updated_at":"2015-07-28T15:21:33Z","pushed_at":"2015-08-04T20:22:55Z","git_url":"git://github.com/mozilla/airmozilla.git","ssh_url":"git@github.com:mozilla/airmozilla.git","clone_url":"https://github.com/mozilla/airmozilla.git","svn_url":"https://github.com/mozilla/airmozilla","homepage":"https://air.mozilla.org","size":19699,"stargazers_count":64,"watchers_count":64,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":3,"forks":59,"open_issues":3,"watchers":64,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/airmozilla/pulls/415"},"html":{"href":"https://github.com/mozilla/airmozilla/pull/415"},"issue":{"href":"https://api.github.com/repos/mozilla/airmozilla/issues/415"},"comments":{"href":"https://api.github.com/repos/mozilla/airmozilla/issues/415/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/airmozilla/pulls/415/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/airmozilla/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/airmozilla/pulls/415/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/airmozilla/statuses/5f9cf48658ea382b189fe91ef39d520bb19015a8"}}}}