{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/normandy/pulls/comments/129986315","pull_request_review_id":52807776,"id":129986315,"diff_hunk":"@@ -50,6 +52,40 @@ def test_recipes_used_by_empty(self):\n         RecipeFactory.create_batch(2, action=action, enabled=False)\n         assert list(action.recipes_used_by) == []\n \n+    def test_update_signature(self, mocker, mock_logger):\n+        # Mock the Autographer\n+        mock_autograph = mocker.patch('normandy.recipes.models.Autographer')\n+        mock_autograph.return_value.sign_data.return_value = [\n+            {'signature': 'fake signature'},\n+        ]\n+\n+        action = ActionFactory(signed=False)\n+        action.update_signature()\n+        mock_logger.info.assert_called_with(\n+            Whatever.contains(action.name),\n+            extra={'code': INFO_REQUESTING_ACTION_SIGNATURES, 'action_names': [action.name]}\n+        )\n+\n+        action.save()\n+        assert action.signature is not None\n+        assert action.signature.signature == 'fake signature'\n+\n+    def test_canonical_json(self):\n+        action = ActionFactory(name='test-action', implementation='console.log(true)')\n+        # Yes, this is ugly, but it needs to compare an exact byte\n+        # sequence, since this is used for hashing and signing\n+        expected = (\n+            f'{{'","path":"recipe-server/normandy/recipes/tests/test_models.py","position":40,"original_position":40,"commit_id":"10107f0fa46fea21cb3e004e7dedfd1bb039ccec","original_commit_id":"10107f0fa46fea21cb3e004e7dedfd1bb039ccec","user":{"login":"Osmose","id":193106,"avatar_url":"https://avatars1.githubusercontent.com/u/193106?v=4","gravatar_id":"","url":"https://api.github.com/users/Osmose","html_url":"https://github.com/Osmose","followers_url":"https://api.github.com/users/Osmose/followers","following_url":"https://api.github.com/users/Osmose/following{/other_user}","gists_url":"https://api.github.com/users/Osmose/gists{/gist_id}","starred_url":"https://api.github.com/users/Osmose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Osmose/subscriptions","organizations_url":"https://api.github.com/users/Osmose/orgs","repos_url":"https://api.github.com/users/Osmose/repos","events_url":"https://api.github.com/users/Osmose/events{/privacy}","received_events_url":"https://api.github.com/users/Osmose/received_events","type":"User","site_admin":false},"body":"I don't see any formatting happening, we can probably just make these all normal strings.","created_at":"2017-07-27T23:54:10Z","updated_at":"2017-07-28T00:00:32Z","html_url":"https://github.com/mozilla/normandy/pull/934#discussion_r129986315","pull_request_url":"https://api.github.com/repos/mozilla/normandy/pulls/934","_links":{"self":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/comments/129986315"},"html":{"href":"https://github.com/mozilla/normandy/pull/934#discussion_r129986315"},"pull_request":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/934"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/normandy/pulls/934","id":132856924,"html_url":"https://github.com/mozilla/normandy/pull/934","diff_url":"https://github.com/mozilla/normandy/pull/934.diff","patch_url":"https://github.com/mozilla/normandy/pull/934.patch","issue_url":"https://api.github.com/repos/mozilla/normandy/issues/934","number":934,"state":"open","locked":false,"title":"recipe-server: Add signatures to actions.","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"body":"This adds signing to actions, including all the APIs and checks that exist for Recipes. This comes dangerously close to wanting some deduplication between the systems, but I think for now leaving them separate will be cleaner.\r\n\r\nNothing is checking this yet. I'm planning on adding on to this PR to include the signature checking bits in the Shield extension. The server side of this is ready to review now.","created_at":"2017-07-27T22:10:00Z","updated_at":"2017-07-28T00:00:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3238d7f85c62c4eb0a7c178f74d5c403691a2f5","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/normandy/pulls/934/commits","review_comments_url":"https://api.github.com/repos/mozilla/normandy/pulls/934/comments","review_comment_url":"https://api.github.com/repos/mozilla/normandy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/normandy/issues/934/comments","statuses_url":"https://api.github.com/repos/mozilla/normandy/statuses/10107f0fa46fea21cb3e004e7dedfd1bb039ccec","head":{"label":"mythmon:sign-actions","ref":"sign-actions","sha":"10107f0fa46fea21cb3e004e7dedfd1bb039ccec","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"repo":{"id":49591352,"name":"normandy","full_name":"mythmon/normandy","owner":{"login":"mythmon","id":305049,"avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mythmon/normandy","description":"Firefox recipe server","fork":true,"url":"https://api.github.com/repos/mythmon/normandy","forks_url":"https://api.github.com/repos/mythmon/normandy/forks","keys_url":"https://api.github.com/repos/mythmon/normandy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mythmon/normandy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mythmon/normandy/teams","hooks_url":"https://api.github.com/repos/mythmon/normandy/hooks","issue_events_url":"https://api.github.com/repos/mythmon/normandy/issues/events{/number}","events_url":"https://api.github.com/repos/mythmon/normandy/events","assignees_url":"https://api.github.com/repos/mythmon/normandy/assignees{/user}","branches_url":"https://api.github.com/repos/mythmon/normandy/branches{/branch}","tags_url":"https://api.github.com/repos/mythmon/normandy/tags","blobs_url":"https://api.github.com/repos/mythmon/normandy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mythmon/normandy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mythmon/normandy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mythmon/normandy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mythmon/normandy/statuses/{sha}","languages_url":"https://api.github.com/repos/mythmon/normandy/languages","stargazers_url":"https://api.github.com/repos/mythmon/normandy/stargazers","contributors_url":"https://api.github.com/repos/mythmon/normandy/contributors","subscribers_url":"https://api.github.com/repos/mythmon/normandy/subscribers","subscription_url":"https://api.github.com/repos/mythmon/normandy/subscription","commits_url":"https://api.github.com/repos/mythmon/normandy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mythmon/normandy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mythmon/normandy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mythmon/normandy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mythmon/normandy/contents/{+path}","compare_url":"https://api.github.com/repos/mythmon/normandy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mythmon/normandy/merges","archive_url":"https://api.github.com/repos/mythmon/normandy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mythmon/normandy/downloads","issues_url":"https://api.github.com/repos/mythmon/normandy/issues{/number}","pulls_url":"https://api.github.com/repos/mythmon/normandy/pulls{/number}","milestones_url":"https://api.github.com/repos/mythmon/normandy/milestones{/number}","notifications_url":"https://api.github.com/repos/mythmon/normandy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mythmon/normandy/labels{/name}","releases_url":"https://api.github.com/repos/mythmon/normandy/releases{/id}","deployments_url":"https://api.github.com/repos/mythmon/normandy/deployments","created_at":"2016-01-13T17:54:36Z","updated_at":"2017-03-08T18:07:21Z","pushed_at":"2017-07-27T22:07:25Z","git_url":"git://github.com/mythmon/normandy.git","ssh_url":"git@github.com:mythmon/normandy.git","clone_url":"https://github.com/mythmon/normandy.git","svn_url":"https://github.com/mythmon/normandy","homepage":"http://normandy.readthedocs.org/","size":4801,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"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":"3572beb442764e7238f277abc0bbae785fe8f4ab","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","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":48456638,"name":"normandy","full_name":"mozilla/normandy","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","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/normandy","description":"Firefox recipe server","fork":false,"url":"https://api.github.com/repos/mozilla/normandy","forks_url":"https://api.github.com/repos/mozilla/normandy/forks","keys_url":"https://api.github.com/repos/mozilla/normandy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/normandy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/normandy/teams","hooks_url":"https://api.github.com/repos/mozilla/normandy/hooks","issue_events_url":"https://api.github.com/repos/mozilla/normandy/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/normandy/events","assignees_url":"https://api.github.com/repos/mozilla/normandy/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/normandy/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/normandy/tags","blobs_url":"https://api.github.com/repos/mozilla/normandy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/normandy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/normandy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/normandy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/normandy/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/normandy/languages","stargazers_url":"https://api.github.com/repos/mozilla/normandy/stargazers","contributors_url":"https://api.github.com/repos/mozilla/normandy/contributors","subscribers_url":"https://api.github.com/repos/mozilla/normandy/subscribers","subscription_url":"https://api.github.com/repos/mozilla/normandy/subscription","commits_url":"https://api.github.com/repos/mozilla/normandy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/normandy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/normandy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/normandy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/normandy/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/normandy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/normandy/merges","archive_url":"https://api.github.com/repos/mozilla/normandy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/normandy/downloads","issues_url":"https://api.github.com/repos/mozilla/normandy/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/normandy/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/normandy/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/normandy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/normandy/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/normandy/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/normandy/deployments","created_at":"2015-12-22T22:18:19Z","updated_at":"2017-06-30T18:09:54Z","pushed_at":"2017-07-27T22:10:01Z","git_url":"git://github.com/mozilla/normandy.git","ssh_url":"git@github.com:mozilla/normandy.git","clone_url":"https://github.com/mozilla/normandy.git","svn_url":"https://github.com/mozilla/normandy","homepage":"https://wiki.mozilla.org/Firefox/Recipe_Server","size":4837,"stargazers_count":19,"watchers_count":19,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":115,"forks":29,"open_issues":115,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/934"},"html":{"href":"https://github.com/mozilla/normandy/pull/934"},"issue":{"href":"https://api.github.com/repos/mozilla/normandy/issues/934"},"comments":{"href":"https://api.github.com/repos/mozilla/normandy/issues/934/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/934/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/934/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/normandy/statuses/10107f0fa46fea21cb3e004e7dedfd1bb039ccec"}}}}
{"actor":{"display_login":"Osmose"}}