{"action":"created","comment":{"url":"https://api.github.com/repos/drone/drone/pulls/comments/28738988","id":28738988,"diff_hunk":"@@ -1,24 +1,138 @@\n package bolt\n \n import (\n-\t\"testing\"\n-\n+\t\"github.com/drone/drone/common\"\n \t. \"github.com/franela/goblin\"\n+\t\"os\"\n+\t\"testing\"\n )\n \n func TestRepo(t *testing.T) {\n \tg := Goblin(t)\n-\tg.Describe(\"Repos\", func() {\n-\n-\t\tg.It(\"Should find by name\")\n-\t\tg.It(\"Should find params\")\n-\t\tg.It(\"Should find keys\")\n-\t\tg.It(\"Should delete\")\n-\t\tg.It(\"Should insert\")\n-\t\tg.It(\"Should not insert if exists\")\n-\t\tg.It(\"Should insert params\")\n-\t\tg.It(\"Should update params\")\n-\t\tg.It(\"Should insert keys\")\n-\t\tg.It(\"Should update keys\")\n+\tg.Describe(\"Repo\", func() {\n+\t\ttestUser := \"octocat\"\n+\t\ttestRepo := \"github.com/octopod/hq\"\n+\t\ttestRepo2 := \"github.com/octopod/avengers\"\n+\t\tvar db *DB // Temp database\n+\n+\t\t// create a new database before each unit\n+\t\t// test and destroy afterwards.\n+\t\tg.BeforeEach(func() {\n+\t\t\tdb = Must(\"/tmp/drone.test.db\")\n+\t\t})\n+\t\tg.AfterEach(func() {\n+\t\t\tos.Remove(db.Path())\n+\t\t})\n+\n+\t\tg.It(\"Should set Repo\", func() {\n+\t\t\t//err := db.SetRepoNotExists(&common.User{Name: testUser}, &common.Repo{Name: testRepo})\n+\t\t\terr := db.SetRepo(&common.Repo{FullName: testRepo})\n+\t\t\tg.Assert(err).Equal(nil)\n+\n+\t\t\t// setrepo only returns an error. Repo returns error and a structure\n+\t\t\trepo, err := db.Repo(testRepo)\n+\t\t\tg.Assert(err).Equal(nil)\n+\t\t\tg.Assert(repo.FullName).Equal(testRepo)\n+\t\t})\n+\n+\t\tg.It(\"Should get Repo\", func() {\n+\t\t\t//db.SetRepoNotExists(&common.User{Name: testUser}, &common.Repo{Name: testRepo})\n+\t\t\tdb.SetRepo(&common.Repo{FullName: testRepo})\n+\n+\t\t\t// setrepo only returns an error. Repo returns error and a structure\n+\t\t\trepo, err := db.Repo(testRepo)\n+\t\t\tg.Assert(err).Equal(nil)\n+\t\t\tg.Assert(repo.FullName).Equal(testRepo)\n+\t\t})\n+\n+\t\tg.It(\"Should del Repo\", func() {\n+\t\t\tdb.SetRepo(&common.Repo{FullName: testRepo})\n+\t\t\t// setrepo only returns an error. Repo returns error and a structure\n+\t\t\t//repo, err := db.Repo(testRepo)\n+\t\t\tdb.Repo(testRepo)\n+\t\t\terr_ := db.DelRepo((&common.Repo{FullName: testRepo}))\n+\t\t\tg.Assert(err_).Equal(nil)\n+\t\t})\n+\n+\t\tg.It(\"Should get RepoList\", func() {\n+\t\t\tdb.SetRepoNotExists(&common.User{Login: testUser}, &common.Repo{FullName: testRepo})\n+\t\t\tdb.SetRepoNotExists(&common.User{Login: testUser}, &common.Repo{FullName: testRepo2})\n+\t\t\t//db.SetRepo(&common.Repo{FullName: testRepo})\n+\t\t\t//db.SetRepo(&common.Repo{FullName: testRepo2})\n+\t\t\trepos, err := db.RepoList(testUser)\n+\t\t\tg.Assert(err).Equal(nil)\n+\t\t\tg.Assert(len(repos)).Equal(2)\n+\t\t})\n+\n+\t\tg.It(\"Should set RepoParams\", func() {\n+\t\t\t//db.SetRepoNotExists(&common.User{Name: testUser}, &common.Repo{Name: testRepo})\n+\t\t\tdb.SetRepo(&common.Repo{FullName: testRepo})\n+\t\t\terr := db.SetRepoParams(testRepo, map[string]string{\"A\": \"Alpha\"})\n+\t\t\tg.Assert(err).Equal(nil)\n+\t\t})\n+\n+\t\tg.It(\"Should get RepoParams\", func() {\n+\t\t\t//db.SetRepoNotExists(&common.User{Name: testUser}, &common.Repo{Name: testRepo})\n+\t\t\tdb.SetRepo(&common.Repo{FullName: testRepo})\n+\t\t\terr := db.SetRepoParams(testRepo, map[string]string{\"A\": \"Alpha\", \"B\": \"Beta\"})\n+\t\t\tparams, err := db.RepoParams(testRepo)\n+\t\t\tg.Assert(err).Equal(nil)\n+\t\t\tg.Assert(len(params)).Equal(2)\n+\t\t\tg.Assert(params[\"A\"]).Equal(\"Alpha\")\n+\t\t\tg.Assert(params[\"B\"]).Equal(\"Beta\")\n+\t\t})\n+\n+\t\t// we test again with same repo/user already existing\n+\t\t// to see if it will return \"ErrConflict\"\n+\t\tg.It(\"Should set SetRepoNotExists\", func() {\n+\t\t\terr := db.SetRepoNotExists(&common.User{Login: testUser}, &common.Repo{FullName: testRepo})\n+\t\t\tg.Assert(err).Equal(nil)\n+\t\t\t// We should get ErrConflict now, trying to add the same repo again.\n+\t\t\terr_ := db.SetRepoNotExists(&common.User{Login: testUser}, &common.Repo{FullName: testRepo})\n+\t\t\tg.Assert(err_ == nil).IsFalse() // we should get (ErrConflict)","path":"datastore/bolt/repo_test.go","position":106,"original_position":106,"commit_id":"627f8df98d0395bd67a47b90c2020d4c232e7cd2","original_commit_id":"627f8df98d0395bd67a47b90c2020d4c232e7cd2","user":{"login":"bradrydzewski","id":817538,"avatar_url":"https://avatars.githubusercontent.com/u/817538?v=3","gravatar_id":"","url":"https://api.github.com/users/bradrydzewski","html_url":"https://github.com/bradrydzewski","followers_url":"https://api.github.com/users/bradrydzewski/followers","following_url":"https://api.github.com/users/bradrydzewski/following{/other_user}","gists_url":"https://api.github.com/users/bradrydzewski/gists{/gist_id}","starred_url":"https://api.github.com/users/bradrydzewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradrydzewski/subscriptions","organizations_url":"https://api.github.com/users/bradrydzewski/orgs","repos_url":"https://api.github.com/users/bradrydzewski/repos","events_url":"https://api.github.com/users/bradrydzewski/events{/privacy}","received_events_url":"https://api.github.com/users/bradrydzewski/received_events","type":"User","site_admin":false},"body":"maybe check `g.Assert(err).Equal(ErrConflict)`?","created_at":"2015-04-20T23:34:27Z","updated_at":"2015-04-20T23:34:27Z","html_url":"https://github.com/drone/drone/pull/986#discussion_r28738988","pull_request_url":"https://api.github.com/repos/drone/drone/pulls/986","_links":{"self":{"href":"https://api.github.com/repos/drone/drone/pulls/comments/28738988"},"html":{"href":"https://github.com/drone/drone/pull/986#discussion_r28738988"},"pull_request":{"href":"https://api.github.com/repos/drone/drone/pulls/986"}}},"pull_request":{"url":"https://api.github.com/repos/drone/drone/pulls/986","id":33715358,"html_url":"https://github.com/drone/drone/pull/986","diff_url":"https://github.com/drone/drone/pull/986.diff","patch_url":"https://github.com/drone/drone/pull/986.patch","issue_url":"https://api.github.com/repos/drone/drone/issues/986","number":986,"state":"open","locked":false,"title":"Unit Tests for: repo_test.go, task_test.go","user":{"login":"oliveiradan","id":3721708,"avatar_url":"https://avatars.githubusercontent.com/u/3721708?v=3","gravatar_id":"","url":"https://api.github.com/users/oliveiradan","html_url":"https://github.com/oliveiradan","followers_url":"https://api.github.com/users/oliveiradan/followers","following_url":"https://api.github.com/users/oliveiradan/following{/other_user}","gists_url":"https://api.github.com/users/oliveiradan/gists{/gist_id}","starred_url":"https://api.github.com/users/oliveiradan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliveiradan/subscriptions","organizations_url":"https://api.github.com/users/oliveiradan/orgs","repos_url":"https://api.github.com/users/oliveiradan/repos","events_url":"https://api.github.com/users/oliveiradan/events{/privacy}","received_events_url":"https://api.github.com/users/oliveiradan/received_events","type":"User","site_admin":false},"body":"@bradrydzewski here it is the new PR you requested. \r\n;\r\ndoliveira@doliveira-opensuse-dev10:~/go/src/github.com/drone/drone> clear; date; make test\r\nMon Apr 20 15:19:14 MDT 2015\r\ngo vet ./...\r\ngo test -cover -short ./...\r\n?       github.com/drone/drone  [no test files]\r\n?       github.com/drone/drone/builder  [no test files]\r\n?       github.com/drone/drone/builder/docker   [no test files]\r\n?       github.com/drone/drone/builder/pool     [no test files]\r\n?       github.com/drone/drone/common   [no test files]\r\n?       github.com/drone/drone/common/ccmenu    [no test files]\r\n?       github.com/drone/drone/common/httputil  [no test files]\r\n?       github.com/drone/drone/common/oauth2    [no test files]\r\n?       github.com/drone/drone/common/sshutil   [no test files]\r\n?       github.com/drone/drone/datastore        [no test files]\r\nok      github.com/drone/drone/datastore/bolt   10.966s coverage: 72.6% of statements\r\n?       github.com/drone/drone/datastore/rpc    [no test files]\r\n?       github.com/drone/drone/eventbus [no test files]\r\nok      github.com/drone/drone/parser   0.002s  coverage: 67.5% of statements\r\nok      github.com/drone/drone/parser/inject    0.002s  coverage: 100.0% of statements\r\nok      github.com/drone/drone/parser/matrix    0.002s  coverage: 68.6% of statements\r\n?       github.com/drone/drone/remote   [no test files]\r\n?       github.com/drone/drone/remote/client    [no test files]\r\n?       github.com/drone/drone/remote/github    [no test files]\r\n?       github.com/drone/drone/server   [no test files]\r\n?       github.com/drone/drone/server/session   [no test files]\r\n?       github.com/drone/drone/settings [no test files]\r\n","created_at":"2015-04-20T23:12:34Z","updated_at":"2015-04-20T23:34:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88d182b3031672cb81427ecae8914cb7d9edcccc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/drone/drone/pulls/986/commits","review_comments_url":"https://api.github.com/repos/drone/drone/pulls/986/comments","review_comment_url":"https://api.github.com/repos/drone/drone/pulls/comments{/number}","comments_url":"https://api.github.com/repos/drone/drone/issues/986/comments","statuses_url":"https://api.github.com/repos/drone/drone/statuses/627f8df98d0395bd67a47b90c2020d4c232e7cd2","head":{"label":"oliveiradan:bolt","ref":"bolt","sha":"627f8df98d0395bd67a47b90c2020d4c232e7cd2","user":{"login":"oliveiradan","id":3721708,"avatar_url":"https://avatars.githubusercontent.com/u/3721708?v=3","gravatar_id":"","url":"https://api.github.com/users/oliveiradan","html_url":"https://github.com/oliveiradan","followers_url":"https://api.github.com/users/oliveiradan/followers","following_url":"https://api.github.com/users/oliveiradan/following{/other_user}","gists_url":"https://api.github.com/users/oliveiradan/gists{/gist_id}","starred_url":"https://api.github.com/users/oliveiradan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliveiradan/subscriptions","organizations_url":"https://api.github.com/users/oliveiradan/orgs","repos_url":"https://api.github.com/users/oliveiradan/repos","events_url":"https://api.github.com/users/oliveiradan/events{/privacy}","received_events_url":"https://api.github.com/users/oliveiradan/received_events","type":"User","site_admin":false},"repo":{"id":34146151,"name":"drone","full_name":"oliveiradan/drone","owner":{"login":"oliveiradan","id":3721708,"avatar_url":"https://avatars.githubusercontent.com/u/3721708?v=3","gravatar_id":"","url":"https://api.github.com/users/oliveiradan","html_url":"https://github.com/oliveiradan","followers_url":"https://api.github.com/users/oliveiradan/followers","following_url":"https://api.github.com/users/oliveiradan/following{/other_user}","gists_url":"https://api.github.com/users/oliveiradan/gists{/gist_id}","starred_url":"https://api.github.com/users/oliveiradan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliveiradan/subscriptions","organizations_url":"https://api.github.com/users/oliveiradan/orgs","repos_url":"https://api.github.com/users/oliveiradan/repos","events_url":"https://api.github.com/users/oliveiradan/events{/privacy}","received_events_url":"https://api.github.com/users/oliveiradan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/oliveiradan/drone","description":"Drone is a Continuous Integration platform built on Docker, written in Go","fork":true,"url":"https://api.github.com/repos/oliveiradan/drone","forks_url":"https://api.github.com/repos/oliveiradan/drone/forks","keys_url":"https://api.github.com/repos/oliveiradan/drone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oliveiradan/drone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oliveiradan/drone/teams","hooks_url":"https://api.github.com/repos/oliveiradan/drone/hooks","issue_events_url":"https://api.github.com/repos/oliveiradan/drone/issues/events{/number}","events_url":"https://api.github.com/repos/oliveiradan/drone/events","assignees_url":"https://api.github.com/repos/oliveiradan/drone/assignees{/user}","branches_url":"https://api.github.com/repos/oliveiradan/drone/branches{/branch}","tags_url":"https://api.github.com/repos/oliveiradan/drone/tags","blobs_url":"https://api.github.com/repos/oliveiradan/drone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oliveiradan/drone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oliveiradan/drone/git/refs{/sha}","trees_url":"https://api.github.com/repos/oliveiradan/drone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oliveiradan/drone/statuses/{sha}","languages_url":"https://api.github.com/repos/oliveiradan/drone/languages","stargazers_url":"https://api.github.com/repos/oliveiradan/drone/stargazers","contributors_url":"https://api.github.com/repos/oliveiradan/drone/contributors","subscribers_url":"https://api.github.com/repos/oliveiradan/drone/subscribers","subscription_url":"https://api.github.com/repos/oliveiradan/drone/subscription","commits_url":"https://api.github.com/repos/oliveiradan/drone/commits{/sha}","git_commits_url":"https://api.github.com/repos/oliveiradan/drone/git/commits{/sha}","comments_url":"https://api.github.com/repos/oliveiradan/drone/comments{/number}","issue_comment_url":"https://api.github.com/repos/oliveiradan/drone/issues/comments{/number}","contents_url":"https://api.github.com/repos/oliveiradan/drone/contents/{+path}","compare_url":"https://api.github.com/repos/oliveiradan/drone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oliveiradan/drone/merges","archive_url":"https://api.github.com/repos/oliveiradan/drone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oliveiradan/drone/downloads","issues_url":"https://api.github.com/repos/oliveiradan/drone/issues{/number}","pulls_url":"https://api.github.com/repos/oliveiradan/drone/pulls{/number}","milestones_url":"https://api.github.com/repos/oliveiradan/drone/milestones{/number}","notifications_url":"https://api.github.com/repos/oliveiradan/drone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oliveiradan/drone/labels{/name}","releases_url":"https://api.github.com/repos/oliveiradan/drone/releases{/id}","created_at":"2015-04-18T00:20:03Z","updated_at":"2015-04-18T00:20:03Z","pushed_at":"2015-04-20T21:04:41Z","git_url":"git://github.com/oliveiradan/drone.git","ssh_url":"git@github.com:oliveiradan/drone.git","clone_url":"https://github.com/oliveiradan/drone.git","svn_url":"https://github.com/oliveiradan/drone","homepage":"","size":10863,"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":"drone:bolt","ref":"bolt","sha":"2001719f7d62b91a7954e400481ae5e1dbe8533c","user":{"login":"drone","id":2181346,"avatar_url":"https://avatars.githubusercontent.com/u/2181346?v=3","gravatar_id":"","url":"https://api.github.com/users/drone","html_url":"https://github.com/drone","followers_url":"https://api.github.com/users/drone/followers","following_url":"https://api.github.com/users/drone/following{/other_user}","gists_url":"https://api.github.com/users/drone/gists{/gist_id}","starred_url":"https://api.github.com/users/drone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drone/subscriptions","organizations_url":"https://api.github.com/users/drone/orgs","repos_url":"https://api.github.com/users/drone/repos","events_url":"https://api.github.com/users/drone/events{/privacy}","received_events_url":"https://api.github.com/users/drone/received_events","type":"Organization","site_admin":false},"repo":{"id":16607898,"name":"drone","full_name":"drone/drone","owner":{"login":"drone","id":2181346,"avatar_url":"https://avatars.githubusercontent.com/u/2181346?v=3","gravatar_id":"","url":"https://api.github.com/users/drone","html_url":"https://github.com/drone","followers_url":"https://api.github.com/users/drone/followers","following_url":"https://api.github.com/users/drone/following{/other_user}","gists_url":"https://api.github.com/users/drone/gists{/gist_id}","starred_url":"https://api.github.com/users/drone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drone/subscriptions","organizations_url":"https://api.github.com/users/drone/orgs","repos_url":"https://api.github.com/users/drone/repos","events_url":"https://api.github.com/users/drone/events{/privacy}","received_events_url":"https://api.github.com/users/drone/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/drone/drone","description":"Drone is a Continuous Integration platform built on Docker, written in Go","fork":false,"url":"https://api.github.com/repos/drone/drone","forks_url":"https://api.github.com/repos/drone/drone/forks","keys_url":"https://api.github.com/repos/drone/drone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drone/drone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drone/drone/teams","hooks_url":"https://api.github.com/repos/drone/drone/hooks","issue_events_url":"https://api.github.com/repos/drone/drone/issues/events{/number}","events_url":"https://api.github.com/repos/drone/drone/events","assignees_url":"https://api.github.com/repos/drone/drone/assignees{/user}","branches_url":"https://api.github.com/repos/drone/drone/branches{/branch}","tags_url":"https://api.github.com/repos/drone/drone/tags","blobs_url":"https://api.github.com/repos/drone/drone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drone/drone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drone/drone/git/refs{/sha}","trees_url":"https://api.github.com/repos/drone/drone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drone/drone/statuses/{sha}","languages_url":"https://api.github.com/repos/drone/drone/languages","stargazers_url":"https://api.github.com/repos/drone/drone/stargazers","contributors_url":"https://api.github.com/repos/drone/drone/contributors","subscribers_url":"https://api.github.com/repos/drone/drone/subscribers","subscription_url":"https://api.github.com/repos/drone/drone/subscription","commits_url":"https://api.github.com/repos/drone/drone/commits{/sha}","git_commits_url":"https://api.github.com/repos/drone/drone/git/commits{/sha}","comments_url":"https://api.github.com/repos/drone/drone/comments{/number}","issue_comment_url":"https://api.github.com/repos/drone/drone/issues/comments{/number}","contents_url":"https://api.github.com/repos/drone/drone/contents/{+path}","compare_url":"https://api.github.com/repos/drone/drone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drone/drone/merges","archive_url":"https://api.github.com/repos/drone/drone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drone/drone/downloads","issues_url":"https://api.github.com/repos/drone/drone/issues{/number}","pulls_url":"https://api.github.com/repos/drone/drone/pulls{/number}","milestones_url":"https://api.github.com/repos/drone/drone/milestones{/number}","notifications_url":"https://api.github.com/repos/drone/drone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drone/drone/labels{/name}","releases_url":"https://api.github.com/repos/drone/drone/releases{/id}","created_at":"2014-02-07T07:54:44Z","updated_at":"2015-04-20T20:00:54Z","pushed_at":"2015-04-20T23:12:34Z","git_url":"git://github.com/drone/drone.git","ssh_url":"git@github.com:drone/drone.git","clone_url":"https://github.com/drone/drone.git","svn_url":"https://github.com/drone/drone","homepage":"","size":19787,"stargazers_count":4777,"watchers_count":4777,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":496,"mirror_url":null,"open_issues_count":145,"forks":496,"open_issues":145,"watchers":4777,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/drone/drone/pulls/986"},"html":{"href":"https://github.com/drone/drone/pull/986"},"issue":{"href":"https://api.github.com/repos/drone/drone/issues/986"},"comments":{"href":"https://api.github.com/repos/drone/drone/issues/986/comments"},"review_comments":{"href":"https://api.github.com/repos/drone/drone/pulls/986/comments"},"review_comment":{"href":"https://api.github.com/repos/drone/drone/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/drone/drone/pulls/986/commits"},"statuses":{"href":"https://api.github.com/repos/drone/drone/statuses/627f8df98d0395bd67a47b90c2020d4c232e7cd2"}}}}