{"action":"opened","issue":{"url":"https://api.github.com/repos/almighty/almighty-core/issues/898","repository_url":"https://api.github.com/repos/almighty/almighty-core","labels_url":"https://api.github.com/repos/almighty/almighty-core/issues/898/labels{/name}","comments_url":"https://api.github.com/repos/almighty/almighty-core/issues/898/comments","events_url":"https://api.github.com/repos/almighty/almighty-core/issues/898/events","html_url":"https://github.com/almighty/almighty-core/issues/898","id":210724498,"number":898,"title":"Remove code duplication in tests","user":{"login":"xcoulon","id":178502,"avatar_url":"https://avatars.githubusercontent.com/u/178502?v=3","gravatar_id":"","url":"https://api.github.com/users/xcoulon","html_url":"https://github.com/xcoulon","followers_url":"https://api.github.com/users/xcoulon/followers","following_url":"https://api.github.com/users/xcoulon/following{/other_user}","gists_url":"https://api.github.com/users/xcoulon/gists{/gist_id}","starred_url":"https://api.github.com/users/xcoulon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcoulon/subscriptions","organizations_url":"https://api.github.com/users/xcoulon/orgs","repos_url":"https://api.github.com/users/xcoulon/repos","events_url":"https://api.github.com/users/xcoulon/events{/privacy}","received_events_url":"https://api.github.com/users/xcoulon/received_events","type":"User","site_admin":false},"labels":[{"id":516119753,"url":"https://api.github.com/repos/almighty/almighty-core/labels/platform","name":"platform","color":"bfdadc","default":false},{"id":435484706,"url":"https://api.github.com/repos/almighty/almighty-core/labels/test","name":"test","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":{"login":"xcoulon","id":178502,"avatar_url":"https://avatars.githubusercontent.com/u/178502?v=3","gravatar_id":"","url":"https://api.github.com/users/xcoulon","html_url":"https://github.com/xcoulon","followers_url":"https://api.github.com/users/xcoulon/followers","following_url":"https://api.github.com/users/xcoulon/following{/other_user}","gists_url":"https://api.github.com/users/xcoulon/gists{/gist_id}","starred_url":"https://api.github.com/users/xcoulon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcoulon/subscriptions","organizations_url":"https://api.github.com/users/xcoulon/orgs","repos_url":"https://api.github.com/users/xcoulon/repos","events_url":"https://api.github.com/users/xcoulon/events{/privacy}","received_events_url":"https://api.github.com/users/xcoulon/received_events","type":"User","site_admin":false},"assignees":[{"login":"xcoulon","id":178502,"avatar_url":"https://avatars.githubusercontent.com/u/178502?v=3","gravatar_id":"","url":"https://api.github.com/users/xcoulon","html_url":"https://github.com/xcoulon","followers_url":"https://api.github.com/users/xcoulon/followers","following_url":"https://api.github.com/users/xcoulon/following{/other_user}","gists_url":"https://api.github.com/users/xcoulon/gists{/gist_id}","starred_url":"https://api.github.com/users/xcoulon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcoulon/subscriptions","organizations_url":"https://api.github.com/users/xcoulon/orgs","repos_url":"https://api.github.com/users/xcoulon/repos","events_url":"https://api.github.com/users/xcoulon/events{/privacy}","received_events_url":"https://api.github.com/users/xcoulon/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/almighty/almighty-core/milestones/13","html_url":"https://github.com/almighty/almighty-core/milestone/13","labels_url":"https://api.github.com/repos/almighty/almighty-core/milestones/13/labels","id":2335877,"number":13,"title":"Sprint #128","description":"","creator":{"login":"joshuawilson","id":1184371,"avatar_url":"https://avatars.githubusercontent.com/u/1184371?v=3","gravatar_id":"","url":"https://api.github.com/users/joshuawilson","html_url":"https://github.com/joshuawilson","followers_url":"https://api.github.com/users/joshuawilson/followers","following_url":"https://api.github.com/users/joshuawilson/following{/other_user}","gists_url":"https://api.github.com/users/joshuawilson/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuawilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuawilson/subscriptions","organizations_url":"https://api.github.com/users/joshuawilson/orgs","repos_url":"https://api.github.com/users/joshuawilson/repos","events_url":"https://api.github.com/users/joshuawilson/events{/privacy}","received_events_url":"https://api.github.com/users/joshuawilson/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":11,"state":"open","created_at":"2017-02-20T21:06:17Z","updated_at":"2017-02-28T08:57:42Z","due_on":"2017-03-14T07:00:00Z","closed_at":null},"comments":0,"created_at":"2017-02-28T08:57:42Z","updated_at":"2017-02-28T08:57:42Z","closed_at":null,"body":"a lot of tests that manipulate work items have the following setup:\r\n\r\n```\r\n// Make sure the database is populated with the correct types (e.g. bug etc.)\r\nif _, c := os.LookupEnv(resource.Database); c != false {\r\n\tif err := models.Transactional(s.DB, func(tx *gorm.DB) error {\r\n\t\treturn migration.PopulateCommonTypes(context.Background(), tx, workitem.NewWorkItemTypeRepository(tx))\r\n\t}); err != nil {\r\n\t\tpanic(err.Error())\r\n\t}\r\n}\r\n```\r\n\r\nthis could be factorized in a function and called whenever necessary, instead of having this block duplicated all over our codebase."}}
{"actor":{"display_login":"xcoulon"}}