{"action":"created","comment":{"url":"https://api.github.com/repos/almighty/almighty-core/pulls/comments/76189861","id":76189861,"diff_hunk":"@@ -0,0 +1,92 @@\n+// +build unit\n+\n+package models\n+\n+import (\n+\t\"encoding/json\"\n+\t\"io/ioutil\"\n+\t\"net/http\"\n+\t\"testing\"\n+)\n+\n+func TestMap(t *testing.T) {\n+\n+\t// This is the Type to be converted to\n+\tworkItemType := wellKnown[\"1\"] // Will remove this and add an actual Type.\n+\n+\tremoteWorkItem := RemoteWorkItem{\n+\t\tFields: map[string]interface{}{\n+\t\t\t\"id\":          \"3\",\n+\t\t\t\"description\": \"I am a remote issue's description in Github\",\n+\t\t\t\"title\":       \"I am the title of the issue\",\n+\t\t},\n+\t}\n+\n+\tworkItemMap := WorkItemMap{\n+\t\t\"id\":          \"remote_issue_id\",\n+\t\t\"description\": \"description\",\n+\t\t\"title\":       \"title\",\n+\t}\n+\tt.Log(\"Test remoteWorkItem\", remoteWorkItem)\n+\tt.Log(\"Test workItemMap \", workItemMap)\n+\n+\t// TODO: Add error handling\n+\tworkItem := remoteWorkItem.MapRemote(workItemMap, workItemType)\n+\n+\t// TODO: compare the workItem fields with those of the remoteWorkItem\n+\n+\tt.Log(\"Test workItem \", workItem)\n+}\n+\n+func TestMapGithub(t *testing.T) {\n+\turl := \"https://api.github.com/repos/almighty/almighty-core/issues/131\"\n+\tresponse, err := http.Get(url)\n+\n+\tif err != nil {\n+\t\tt.Error(\"Error fetching github api data \")\n+\t}\n+\n+\tdefer response.Body.Close()\n+\tresponseData, err := ioutil.ReadAll(response.Body)","path":"models/remoteworkitem_test.go","position":50,"original_position":50,"commit_id":"f533bf96759bfe431d11322e0980975a717ee659","original_commit_id":"f533bf96759bfe431d11322e0980975a717ee659","user":{"login":"aslakknutsen","id":132158,"avatar_url":"https://avatars.githubusercontent.com/u/132158?v=3","gravatar_id":"","url":"https://api.github.com/users/aslakknutsen","html_url":"https://github.com/aslakknutsen","followers_url":"https://api.github.com/users/aslakknutsen/followers","following_url":"https://api.github.com/users/aslakknutsen/following{/other_user}","gists_url":"https://api.github.com/users/aslakknutsen/gists{/gist_id}","starred_url":"https://api.github.com/users/aslakknutsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aslakknutsen/subscriptions","organizations_url":"https://api.github.com/users/aslakknutsen/orgs","repos_url":"https://api.github.com/users/aslakknutsen/repos","events_url":"https://api.github.com/users/aslakknutsen/events{/privacy}","received_events_url":"https://api.github.com/users/aslakknutsen/received_events","type":"User","site_admin":false},"body":"If you use https://golang.org/pkg/encoding/json/#NewDecoder you don't have to read the response data as a string first.","created_at":"2016-08-25T06:59:51Z","updated_at":"2016-08-25T06:59:51Z","html_url":"https://github.com/almighty/almighty-core/pull/152#discussion_r76189861","pull_request_url":"https://api.github.com/repos/almighty/almighty-core/pulls/152","_links":{"self":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/comments/76189861"},"html":{"href":"https://github.com/almighty/almighty-core/pull/152#discussion_r76189861"},"pull_request":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/152"}}},"pull_request":{"url":"https://api.github.com/repos/almighty/almighty-core/pulls/152","id":82367357,"html_url":"https://github.com/almighty/almighty-core/pull/152","diff_url":"https://github.com/almighty/almighty-core/pull/152.diff","patch_url":"https://github.com/almighty/almighty-core/pull/152.patch","issue_url":"https://api.github.com/repos/almighty/almighty-core/issues/152","number":152,"state":"open","locked":false,"title":"WIP : Putting in the design for mapping remote work items","user":{"login":"sbose78","id":545280,"avatar_url":"https://avatars.githubusercontent.com/u/545280?v=3","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"body":"As per discussion and design suggestion by @aslakknutsen on https://github.com/almighty/almighty-core/issues/131  \r\n\r\nA ```GithubWorkItem``` is derived from  ```RemoteWorkItem```.\r\n```RemoteWorkItem``` has the ```MapRemote()``` method which takes 2 parameters.\r\n\r\n1.  the Key Map of remote -->local workitem field keys\r\n2. the local WorkItemType ( the type we want the remote items to be imported as )\r\n\r\nFor (1) the  remote-to-local integration code could use the derived type's own optional implementation of ```GetWorkItemKeyMap()``` and ```Flatten()```, if any.\r\n\r\n\r\nAll of  ```RemoteWorkItem```'s derived types can use the ```MapRemote``` method. \r\n\r\n\r\n\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/almighty/almighty-core/152)\r\n<!-- Reviewable:end -->\r\n","created_at":"2016-08-23T13:44:54Z","updated_at":"2016-08-25T06:59:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f360c1e2d8b6919ea3bfb2b82caf7f9012e9624","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/almighty/almighty-core/pulls/152/commits","review_comments_url":"https://api.github.com/repos/almighty/almighty-core/pulls/152/comments","review_comment_url":"https://api.github.com/repos/almighty/almighty-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/almighty/almighty-core/issues/152/comments","statuses_url":"https://api.github.com/repos/almighty/almighty-core/statuses/f533bf96759bfe431d11322e0980975a717ee659","head":{"label":"sbose78:remote-wi-to-local-wi","ref":"remote-wi-to-local-wi","sha":"f533bf96759bfe431d11322e0980975a717ee659","user":{"login":"sbose78","id":545280,"avatar_url":"https://avatars.githubusercontent.com/u/545280?v=3","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"repo":{"id":64824078,"name":"almighty-core","full_name":"sbose78/almighty-core","owner":{"login":"sbose78","id":545280,"avatar_url":"https://avatars.githubusercontent.com/u/545280?v=3","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sbose78/almighty-core","description":null,"fork":true,"url":"https://api.github.com/repos/sbose78/almighty-core","forks_url":"https://api.github.com/repos/sbose78/almighty-core/forks","keys_url":"https://api.github.com/repos/sbose78/almighty-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sbose78/almighty-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sbose78/almighty-core/teams","hooks_url":"https://api.github.com/repos/sbose78/almighty-core/hooks","issue_events_url":"https://api.github.com/repos/sbose78/almighty-core/issues/events{/number}","events_url":"https://api.github.com/repos/sbose78/almighty-core/events","assignees_url":"https://api.github.com/repos/sbose78/almighty-core/assignees{/user}","branches_url":"https://api.github.com/repos/sbose78/almighty-core/branches{/branch}","tags_url":"https://api.github.com/repos/sbose78/almighty-core/tags","blobs_url":"https://api.github.com/repos/sbose78/almighty-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sbose78/almighty-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sbose78/almighty-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/sbose78/almighty-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sbose78/almighty-core/statuses/{sha}","languages_url":"https://api.github.com/repos/sbose78/almighty-core/languages","stargazers_url":"https://api.github.com/repos/sbose78/almighty-core/stargazers","contributors_url":"https://api.github.com/repos/sbose78/almighty-core/contributors","subscribers_url":"https://api.github.com/repos/sbose78/almighty-core/subscribers","subscription_url":"https://api.github.com/repos/sbose78/almighty-core/subscription","commits_url":"https://api.github.com/repos/sbose78/almighty-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/sbose78/almighty-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/sbose78/almighty-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/sbose78/almighty-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/sbose78/almighty-core/contents/{+path}","compare_url":"https://api.github.com/repos/sbose78/almighty-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sbose78/almighty-core/merges","archive_url":"https://api.github.com/repos/sbose78/almighty-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sbose78/almighty-core/downloads","issues_url":"https://api.github.com/repos/sbose78/almighty-core/issues{/number}","pulls_url":"https://api.github.com/repos/sbose78/almighty-core/pulls{/number}","milestones_url":"https://api.github.com/repos/sbose78/almighty-core/milestones{/number}","notifications_url":"https://api.github.com/repos/sbose78/almighty-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sbose78/almighty-core/labels{/name}","releases_url":"https://api.github.com/repos/sbose78/almighty-core/releases{/id}","deployments_url":"https://api.github.com/repos/sbose78/almighty-core/deployments","created_at":"2016-08-03T07:12:02Z","updated_at":"2016-08-05T15:12:18Z","pushed_at":"2016-08-25T05:21:43Z","git_url":"git://github.com/sbose78/almighty-core.git","ssh_url":"git@github.com:sbose78/almighty-core.git","clone_url":"https://github.com/sbose78/almighty-core.git","svn_url":"https://github.com/sbose78/almighty-core","homepage":"http://devdoc.almighty.io","size":208,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"almighty:master","ref":"master","sha":"da4607769d3103a3c0a83ad49ab67c3852261d11","user":{"login":"almighty","id":17783151,"avatar_url":"https://avatars.githubusercontent.com/u/17783151?v=3","gravatar_id":"","url":"https://api.github.com/users/almighty","html_url":"https://github.com/almighty","followers_url":"https://api.github.com/users/almighty/followers","following_url":"https://api.github.com/users/almighty/following{/other_user}","gists_url":"https://api.github.com/users/almighty/gists{/gist_id}","starred_url":"https://api.github.com/users/almighty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almighty/subscriptions","organizations_url":"https://api.github.com/users/almighty/orgs","repos_url":"https://api.github.com/users/almighty/repos","events_url":"https://api.github.com/users/almighty/events{/privacy}","received_events_url":"https://api.github.com/users/almighty/received_events","type":"Organization","site_admin":false},"repo":{"id":54260706,"name":"almighty-core","full_name":"almighty/almighty-core","owner":{"login":"almighty","id":17783151,"avatar_url":"https://avatars.githubusercontent.com/u/17783151?v=3","gravatar_id":"","url":"https://api.github.com/users/almighty","html_url":"https://github.com/almighty","followers_url":"https://api.github.com/users/almighty/followers","following_url":"https://api.github.com/users/almighty/following{/other_user}","gists_url":"https://api.github.com/users/almighty/gists{/gist_id}","starred_url":"https://api.github.com/users/almighty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almighty/subscriptions","organizations_url":"https://api.github.com/users/almighty/orgs","repos_url":"https://api.github.com/users/almighty/repos","events_url":"https://api.github.com/users/almighty/events{/privacy}","received_events_url":"https://api.github.com/users/almighty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/almighty/almighty-core","description":"","fork":false,"url":"https://api.github.com/repos/almighty/almighty-core","forks_url":"https://api.github.com/repos/almighty/almighty-core/forks","keys_url":"https://api.github.com/repos/almighty/almighty-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/almighty/almighty-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/almighty/almighty-core/teams","hooks_url":"https://api.github.com/repos/almighty/almighty-core/hooks","issue_events_url":"https://api.github.com/repos/almighty/almighty-core/issues/events{/number}","events_url":"https://api.github.com/repos/almighty/almighty-core/events","assignees_url":"https://api.github.com/repos/almighty/almighty-core/assignees{/user}","branches_url":"https://api.github.com/repos/almighty/almighty-core/branches{/branch}","tags_url":"https://api.github.com/repos/almighty/almighty-core/tags","blobs_url":"https://api.github.com/repos/almighty/almighty-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/almighty/almighty-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/almighty/almighty-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/almighty/almighty-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/almighty/almighty-core/statuses/{sha}","languages_url":"https://api.github.com/repos/almighty/almighty-core/languages","stargazers_url":"https://api.github.com/repos/almighty/almighty-core/stargazers","contributors_url":"https://api.github.com/repos/almighty/almighty-core/contributors","subscribers_url":"https://api.github.com/repos/almighty/almighty-core/subscribers","subscription_url":"https://api.github.com/repos/almighty/almighty-core/subscription","commits_url":"https://api.github.com/repos/almighty/almighty-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/almighty/almighty-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/almighty/almighty-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/almighty/almighty-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/almighty/almighty-core/contents/{+path}","compare_url":"https://api.github.com/repos/almighty/almighty-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/almighty/almighty-core/merges","archive_url":"https://api.github.com/repos/almighty/almighty-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/almighty/almighty-core/downloads","issues_url":"https://api.github.com/repos/almighty/almighty-core/issues{/number}","pulls_url":"https://api.github.com/repos/almighty/almighty-core/pulls{/number}","milestones_url":"https://api.github.com/repos/almighty/almighty-core/milestones{/number}","notifications_url":"https://api.github.com/repos/almighty/almighty-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/almighty/almighty-core/labels{/name}","releases_url":"https://api.github.com/repos/almighty/almighty-core/releases{/id}","deployments_url":"https://api.github.com/repos/almighty/almighty-core/deployments","created_at":"2016-03-19T10:42:15Z","updated_at":"2016-08-17T15:36:53Z","pushed_at":"2016-08-25T06:28:25Z","git_url":"git://github.com/almighty/almighty-core.git","ssh_url":"git@github.com:almighty/almighty-core.git","clone_url":"https://github.com/almighty/almighty-core.git","svn_url":"https://github.com/almighty/almighty-core","homepage":"http://devdoc.almighty.io/","size":4178,"stargazers_count":6,"watchers_count":6,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":54,"forks":21,"open_issues":54,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/152"},"html":{"href":"https://github.com/almighty/almighty-core/pull/152"},"issue":{"href":"https://api.github.com/repos/almighty/almighty-core/issues/152"},"comments":{"href":"https://api.github.com/repos/almighty/almighty-core/issues/152/comments"},"review_comments":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/152/comments"},"review_comment":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/almighty/almighty-core/pulls/152/commits"},"statuses":{"href":"https://api.github.com/repos/almighty/almighty-core/statuses/f533bf96759bfe431d11322e0980975a717ee659"}}}}
{"actor":{"display_login":"aslakknutsen"}}