{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/client/pulls/comments/77707291","id":77707291,"diff_hunk":"@@ -1,4 +1,647 @@\n-// Copyright 2015 Keybase, Inc. All rights reserved. Use of\n+// Copyright 2016 Keybase, Inc. All rights reserved. Use of\n // this source code is governed by the included BSD license.\n \n package pvl\n+\n+import (\n+\t\"fmt\"\n+\t\"strings\"\n+\t\"testing\"\n+\n+\t\"github.com/PuerkitoBio/goquery\"\n+\tlibkb \"github.com/keybase/client/go/libkb\"\n+\tkeybase1 \"github.com/keybase/client/go/protocol/keybase1\"\n+\tjsonw \"github.com/keybase/go-jsonw\"\n+)\n+\n+type interpUnitTest struct {\n+\tname      string\n+\tproofinfo ProofInfo\n+\tprepvl    map[keybase1.ProofType]string\n+\tservice   keybase1.ProofType\n+\n+\t// What api call to expect\n+\trestype     libkb.XAPIResType\n+\tresjson     string\n+\treshtml     string\n+\trestext     string\n+\turloverride string\n+\t// (Optional) Expect a different url to be fetched than proofinfo.APIURL\n+\n+\t// Whether the proof should validate\n+\tshouldwork bool\n+\t// (Optional) error status must equal. Must be specified for INVALID_PVL\n+\terrstatus keybase1.ProofStatus\n+\t// (Optional) error string must equal\n+\terrstr string\n+}\n+\n+var interpUnitTests = []interpUnitTest{\n+\t// # Basic tests\n+\t{\n+\t\tname:      \"basichtml\",\n+\t\tproofinfo: info1,\n+\t\tprepvl: map[keybase1.ProofType]string{\n+\t\t\tkeybase1.ProofType_TWITTER: `[\n+{\"assert_regex_match\": \"^https://rooter\\\\.example\\\\.com/proofs/%{username_service}/[\\\\d]+\\\\.htjsxt$\"},\n+{\"fetch\": \"html\"},\n+{\"selector_css\": [\".twit\", 0]},\n+{\"whitespace_normalize\": true},\n+{\"assert_regex_match\": \"^.*goodproof.*$\"}\n+]`},\n+\t\tservice:    keybase1.ProofType_TWITTER,\n+\t\trestype:    libkb.XAPIResHTML,\n+\t\treshtml:    html1,\n+\t\tshouldwork: true,\n+\t},\n+\n+\t// # Tests for individual valid instructions.\n+\t// Test match and fail of each instruction.\n+\n+\t// ## AssertRegexMatch,\n+\t{\n+\t\tname:      \"AssertRegexMatch-url-ok\",\n+\t\tproofinfo: info1,\n+\t\tprepvl: map[keybase1.ProofType]string{\n+\t\t\tkeybase1.ProofType_COINBASE: `[\n+{\"assert_regex_match\": \"^https://rooter\\\\.example\\\\.com/proofs/%{username_service}/[\\\\d]+\\\\.htjsxt$\"},\n+{\"fetch\": \"string\"}\n+]`},\n+\t\tservice:    keybase1.ProofType_COINBASE,\n+\t\trestype:    libkb.XAPIResText,\n+\t\trestext:    \"1234\",\n+\t\tshouldwork: true,\n+\t}, {\n+\t\tname:      \"AssertRegexMatch-url-fail\",\n+\t\tproofinfo: info1,\n+\t\tprepvl: map[keybase1.ProofType]string{\n+\t\t\tkeybase1.ProofType_HACKERNEWS: `[\n+{\"assert_regex_match\": \"^https://rooter\\\\.example\\\\.com/proofs/%{username_service}/+\\\\.htjsxt$\"},\n+{\"fetch\": \"string\"}\n+]`},\n+\t\tservice:    keybase1.ProofType_HACKERNEWS,\n+\t\trestype:    libkb.XAPIResText,\n+\t\trestext:    \"1234\",\n+\t\tshouldwork: false,\n+\t}, {\n+\t\tname:      \"AssertRegexMatch-content-ok\",\n+\t\tproofinfo: info1,\n+\t\tprepvl: map[keybase1.ProofType]string{\n+\t\t\tkeybase1.ProofType_REDDIT: `[","path":"go/pvl/interp_test.go","position":91,"original_position":91,"commit_id":"535b4b792895b08ae6ce1b0f7f2aa762d8e1ea84","original_commit_id":"535b4b792895b08ae6ce1b0f7f2aa762d8e1ea84","user":{"login":"maxtaco","id":866815,"avatar_url":"https://avatars.githubusercontent.com/u/866815?v=3","gravatar_id":"","url":"https://api.github.com/users/maxtaco","html_url":"https://github.com/maxtaco","followers_url":"https://api.github.com/users/maxtaco/followers","following_url":"https://api.github.com/users/maxtaco/following{/other_user}","gists_url":"https://api.github.com/users/maxtaco/gists{/gist_id}","starred_url":"https://api.github.com/users/maxtaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxtaco/subscriptions","organizations_url":"https://api.github.com/users/maxtaco/orgs","repos_url":"https://api.github.com/users/maxtaco/repos","events_url":"https://api.github.com/users/maxtaco/events{/privacy}","received_events_url":"https://api.github.com/users/maxtaco/received_events","type":"User","site_admin":false},"body":"should this be a twitter proof, and not a reddit proof?","created_at":"2016-09-06T20:00:42Z","updated_at":"2016-09-06T20:00:42Z","html_url":"https://github.com/keybase/client/pull/4191#discussion_r77707291","pull_request_url":"https://api.github.com/repos/keybase/client/pulls/4191","_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/comments/77707291"},"html":{"href":"https://github.com/keybase/client/pull/4191#discussion_r77707291"},"pull_request":{"href":"https://api.github.com/repos/keybase/client/pulls/4191"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/client/pulls/4191","id":84159868,"html_url":"https://github.com/keybase/client/pull/4191","diff_url":"https://github.com/keybase/client/pull/4191.diff","patch_url":"https://github.com/keybase/client/pull/4191.patch","issue_url":"https://api.github.com/repos/keybase/client/issues/4191","number":4191,"state":"open","locked":false,"title":"Add pvl instruction tests","user":{"login":"mlsteele","id":705646,"avatar_url":"https://avatars.githubusercontent.com/u/705646?v=3","gravatar_id":"","url":"https://api.github.com/users/mlsteele","html_url":"https://github.com/mlsteele","followers_url":"https://api.github.com/users/mlsteele/followers","following_url":"https://api.github.com/users/mlsteele/following{/other_user}","gists_url":"https://api.github.com/users/mlsteele/gists{/gist_id}","starred_url":"https://api.github.com/users/mlsteele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlsteele/subscriptions","organizations_url":"https://api.github.com/users/mlsteele/orgs","repos_url":"https://api.github.com/users/mlsteele/repos","events_url":"https://api.github.com/users/mlsteele/events{/privacy}","received_events_url":"https://api.github.com/users/mlsteele/received_events","type":"User","site_admin":false},"body":"Adds some tests for each instruction. These tests should cover normal operation of pvl (both succeeding and failing instructions). They do not cover the darker corners of malformed pvl, running dns proofs, nor malformed top-level pvl.\r\n\r\nOther goodies:\r\n- add mocking mode to `StubAPIEngine`\r\n- fixed crash on negative indices in selectors\r\n- added `func pyindex` so that negative indices act as specified\r\n\r\nr? @maxtaco @oconnor663 ","created_at":"2016-09-06T17:05:27Z","updated_at":"2016-09-06T20:00:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55c4ec0b59302f1ef65b3c5147c43206c44082d4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/client/pulls/4191/commits","review_comments_url":"https://api.github.com/repos/keybase/client/pulls/4191/comments","review_comment_url":"https://api.github.com/repos/keybase/client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/client/issues/4191/comments","statuses_url":"https://api.github.com/repos/keybase/client/statuses/535b4b792895b08ae6ce1b0f7f2aa762d8e1ea84","head":{"label":"keybase:miles/CORE-3527-pvl-tests2","ref":"miles/CORE-3527-pvl-tests2","sha":"535b4b792895b08ae6ce1b0f7f2aa762d8e1ea84","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2016-09-06T18:26:37Z","pushed_at":"2016-09-06T19:33:59Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":160634,"stargazers_count":746,"watchers_count":746,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":63,"mirror_url":null,"open_issues_count":476,"forks":63,"open_issues":476,"watchers":746,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"1f66ba7e35102abe72ff56fb5fe132a613eba361","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":29099181,"name":"client","full_name":"keybase/client","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/client","description":"Keybase Go Library, Client, Service, OS X, iOS, Android, Electron","fork":false,"url":"https://api.github.com/repos/keybase/client","forks_url":"https://api.github.com/repos/keybase/client/forks","keys_url":"https://api.github.com/repos/keybase/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/client/teams","hooks_url":"https://api.github.com/repos/keybase/client/hooks","issue_events_url":"https://api.github.com/repos/keybase/client/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/client/events","assignees_url":"https://api.github.com/repos/keybase/client/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/client/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/client/tags","blobs_url":"https://api.github.com/repos/keybase/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/client/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/client/languages","stargazers_url":"https://api.github.com/repos/keybase/client/stargazers","contributors_url":"https://api.github.com/repos/keybase/client/contributors","subscribers_url":"https://api.github.com/repos/keybase/client/subscribers","subscription_url":"https://api.github.com/repos/keybase/client/subscription","commits_url":"https://api.github.com/repos/keybase/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/client/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/client/merges","archive_url":"https://api.github.com/repos/keybase/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/client/downloads","issues_url":"https://api.github.com/repos/keybase/client/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/client/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/client/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/client/labels{/name}","releases_url":"https://api.github.com/repos/keybase/client/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/client/deployments","created_at":"2015-01-11T17:17:12Z","updated_at":"2016-09-06T18:26:37Z","pushed_at":"2016-09-06T19:33:59Z","git_url":"git://github.com/keybase/client.git","ssh_url":"git@github.com:keybase/client.git","clone_url":"https://github.com/keybase/client.git","svn_url":"https://github.com/keybase/client","homepage":"","size":160634,"stargazers_count":746,"watchers_count":746,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":63,"mirror_url":null,"open_issues_count":476,"forks":63,"open_issues":476,"watchers":746,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/client/pulls/4191"},"html":{"href":"https://github.com/keybase/client/pull/4191"},"issue":{"href":"https://api.github.com/repos/keybase/client/issues/4191"},"comments":{"href":"https://api.github.com/repos/keybase/client/issues/4191/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/client/pulls/4191/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/client/pulls/4191/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/client/statuses/535b4b792895b08ae6ce1b0f7f2aa762d8e1ea84"}}}}
{"actor":{"display_login":"maxtaco"}}