{"action":"created","comment":{"url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments/37629447","id":37629447,"diff_hunk":"@@ -37,3 +38,31 @@ def enable_rhrepo_and_fetchid(basearch, org_id, product, repo,\n             result = entities.Repository(name=repo).search(\n                 query={'organization_id': org_id})\n     return result[0].id\n+\n+\n+def promote(content_view_version, environment_id):\n+    \"\"\"Call ``content_view_version.promote(…)``.\n+\n+    :param content_view_version: A ``nailgun.entities.ContentViewVersion``\n+        object.\n+    :param environment_id: An environment ID.\n+    :returns: Whatever ``nailgun.entities.ContentViewVersion.promote`` returns.\n+\n+    \"\"\"\n+    return content_view_version.promote(data={\n+        u'environment_id': environment_id\n+    })\n+\n+\n+def upload(organization_id, manifest):","path":"robottelo/api/utils.py","position":25,"original_position":25,"commit_id":"ad8563c665fdb5de9d1215db704fddf44e2766a6","original_commit_id":"ad8563c665fdb5de9d1215db704fddf44e2766a6","user":{"login":"omaciel","id":53362,"avatar_url":"https://avatars.githubusercontent.com/u/53362?v=3","gravatar_id":"","url":"https://api.github.com/users/omaciel","html_url":"https://github.com/omaciel","followers_url":"https://api.github.com/users/omaciel/followers","following_url":"https://api.github.com/users/omaciel/following{/other_user}","gists_url":"https://api.github.com/users/omaciel/gists{/gist_id}","starred_url":"https://api.github.com/users/omaciel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omaciel/subscriptions","organizations_url":"https://api.github.com/users/omaciel/orgs","repos_url":"https://api.github.com/users/omaciel/repos","events_url":"https://api.github.com/users/omaciel/events{/privacy}","received_events_url":"https://api.github.com/users/omaciel/received_events","type":"User","site_admin":false},"body":"I think so","created_at":"2015-08-21T12:31:19Z","updated_at":"2015-08-21T12:31:19Z","html_url":"https://github.com/SatelliteQE/robottelo/pull/2695#discussion_r37629447","pull_request_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695","_links":{"self":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments/37629447"},"html":{"href":"https://github.com/SatelliteQE/robottelo/pull/2695#discussion_r37629447"},"pull_request":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695"}}},"pull_request":{"url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695","id":42860764,"html_url":"https://github.com/SatelliteQE/robottelo/pull/2695","diff_url":"https://github.com/SatelliteQE/robottelo/pull/2695.diff","patch_url":"https://github.com/SatelliteQE/robottelo/pull/2695.patch","issue_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2695","number":2695,"state":"open","locked":false,"title":"Add functions that wrap common API calls","user":{"login":"Ichimonji10","id":1012989,"avatar_url":"https://avatars.githubusercontent.com/u/1012989?v=3","gravatar_id":"","url":"https://api.github.com/users/Ichimonji10","html_url":"https://github.com/Ichimonji10","followers_url":"https://api.github.com/users/Ichimonji10/followers","following_url":"https://api.github.com/users/Ichimonji10/following{/other_user}","gists_url":"https://api.github.com/users/Ichimonji10/gists{/gist_id}","starred_url":"https://api.github.com/users/Ichimonji10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ichimonji10/subscriptions","organizations_url":"https://api.github.com/users/Ichimonji10/orgs","repos_url":"https://api.github.com/users/Ichimonji10/repos","events_url":"https://api.github.com/users/Ichimonji10/events{/privacy}","received_events_url":"https://api.github.com/users/Ichimonji10/received_events","type":"User","site_admin":false},"body":"Fix #2683:\r\n\r\n> Some modules call the same NailGun helper method with an identical set of\r\n> arguments over and over. For example, module `test_contentview.py` calls\r\n> `ContentViewVersion.promote` fifteen times! Each call looks something like\r\n> this:\r\n>\r\n>     content_view.version[0].promote(data={u'environment_id': lc_env.id})\r\n>\r\n> It'd be nice if we didn't have to write out `{u'environment_id': ...}` in\r\n> every single one of those calls.\r\n\r\nAdd the following functions to module `robottelo.api.utils`:\r\n\r\n* promote (calls `ContentViewVersion.promote`)\r\n* upload (calls `Subscription.upload`)\r\n\r\nUse these functions to eliminate some redundant code. Test results:\r\n\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/api/test_contentview.py:ContentViewTestCase -m test_subscribe_system_to_cv\r\n    .\r\n    ----------------------------------------------------------------------\r\n    Ran 1 test in 38.112s\r\n\r\n    OK\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/api/test_contentview.py:ContentViewTestCase -m test_cv_clone_within_same_env\r\n    .\r\n    ----------------------------------------------------------------------\r\n    Ran 1 test in 52.971s\r\n\r\n    OK\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/api/test_contentview.py:ContentViewTestCase -m test_cv_clone_within_diff_env\r\n    .\r\n    ----------------------------------------------------------------------\r\n    Ran 1 test in 64.620s\r\n\r\n    OK\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/api/test_contentview.py:CVPublishPromoteTestCase -m test_positive_promote_\r\n    ..\r\n    ----------------------------------------------------------------------\r\n    Ran 2 tests in 208.323s\r\n\r\n    OK\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/api/test_contentview.py:CVPublishPromoteTestCase -m test_promote_cv_with_puppet_once\r\n    .\r\n    ----------------------------------------------------------------------\r\n    Ran 1 test in 81.161s\r\n\r\n    OK\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/api/test_contentview.py:CVPublishPromoteTestCase -m test_promote_cv_with_puppet_multiple\r\n    .\r\n    ----------------------------------------------------------------------\r\n    Ran 1 test in 109.295s\r\n\r\n    OK\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/api/test_contentview.py:CVPublishPromoteTestCase -m test_promote_composite_cv_\r\n    ....\r\n    ----------------------------------------------------------------------\r\n    Ran 4 tests in 403.297s\r\n\r\n    OK\r\n\r\nThe above tests the `promote` function. The below tests all three functions in\r\nmodule `robottelo.api.utils`:\r\n\r\n    (robottelo2)[ichimonji10@beech:robottelo]$ nosetests tests/foreman/ui/test_activationkey.py\r\n    EE.EFSE..............S...............SF.E.................................................................E.....\r\n\r\nThe errors are due to unrelated issues like no provisioning server being\r\nconfigured.","created_at":"2015-08-19T20:35:36Z","updated_at":"2015-08-21T12:31:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"208a91ca1836d38257e8e8361b71225aa207b273","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695/commits","review_comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695/comments","review_comment_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2695/comments","statuses_url":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/ad8563c665fdb5de9d1215db704fddf44e2766a6","head":{"label":"Ichimonji10:repetitiveness","ref":"repetitiveness","sha":"ad8563c665fdb5de9d1215db704fddf44e2766a6","user":{"login":"Ichimonji10","id":1012989,"avatar_url":"https://avatars.githubusercontent.com/u/1012989?v=3","gravatar_id":"","url":"https://api.github.com/users/Ichimonji10","html_url":"https://github.com/Ichimonji10","followers_url":"https://api.github.com/users/Ichimonji10/followers","following_url":"https://api.github.com/users/Ichimonji10/following{/other_user}","gists_url":"https://api.github.com/users/Ichimonji10/gists{/gist_id}","starred_url":"https://api.github.com/users/Ichimonji10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ichimonji10/subscriptions","organizations_url":"https://api.github.com/users/Ichimonji10/orgs","repos_url":"https://api.github.com/users/Ichimonji10/repos","events_url":"https://api.github.com/users/Ichimonji10/events{/privacy}","received_events_url":"https://api.github.com/users/Ichimonji10/received_events","type":"User","site_admin":false},"repo":{"id":20566902,"name":"robottelo","full_name":"Ichimonji10/robottelo","owner":{"login":"Ichimonji10","id":1012989,"avatar_url":"https://avatars.githubusercontent.com/u/1012989?v=3","gravatar_id":"","url":"https://api.github.com/users/Ichimonji10","html_url":"https://github.com/Ichimonji10","followers_url":"https://api.github.com/users/Ichimonji10/followers","following_url":"https://api.github.com/users/Ichimonji10/following{/other_user}","gists_url":"https://api.github.com/users/Ichimonji10/gists{/gist_id}","starred_url":"https://api.github.com/users/Ichimonji10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ichimonji10/subscriptions","organizations_url":"https://api.github.com/users/Ichimonji10/orgs","repos_url":"https://api.github.com/users/Ichimonji10/repos","events_url":"https://api.github.com/users/Ichimonji10/events{/privacy}","received_events_url":"https://api.github.com/users/Ichimonji10/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Ichimonji10/robottelo","description":"An automation testing framework for the Katello project.","fork":true,"url":"https://api.github.com/repos/Ichimonji10/robottelo","forks_url":"https://api.github.com/repos/Ichimonji10/robottelo/forks","keys_url":"https://api.github.com/repos/Ichimonji10/robottelo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ichimonji10/robottelo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ichimonji10/robottelo/teams","hooks_url":"https://api.github.com/repos/Ichimonji10/robottelo/hooks","issue_events_url":"https://api.github.com/repos/Ichimonji10/robottelo/issues/events{/number}","events_url":"https://api.github.com/repos/Ichimonji10/robottelo/events","assignees_url":"https://api.github.com/repos/Ichimonji10/robottelo/assignees{/user}","branches_url":"https://api.github.com/repos/Ichimonji10/robottelo/branches{/branch}","tags_url":"https://api.github.com/repos/Ichimonji10/robottelo/tags","blobs_url":"https://api.github.com/repos/Ichimonji10/robottelo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ichimonji10/robottelo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ichimonji10/robottelo/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ichimonji10/robottelo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ichimonji10/robottelo/statuses/{sha}","languages_url":"https://api.github.com/repos/Ichimonji10/robottelo/languages","stargazers_url":"https://api.github.com/repos/Ichimonji10/robottelo/stargazers","contributors_url":"https://api.github.com/repos/Ichimonji10/robottelo/contributors","subscribers_url":"https://api.github.com/repos/Ichimonji10/robottelo/subscribers","subscription_url":"https://api.github.com/repos/Ichimonji10/robottelo/subscription","commits_url":"https://api.github.com/repos/Ichimonji10/robottelo/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ichimonji10/robottelo/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ichimonji10/robottelo/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ichimonji10/robottelo/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ichimonji10/robottelo/contents/{+path}","compare_url":"https://api.github.com/repos/Ichimonji10/robottelo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ichimonji10/robottelo/merges","archive_url":"https://api.github.com/repos/Ichimonji10/robottelo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ichimonji10/robottelo/downloads","issues_url":"https://api.github.com/repos/Ichimonji10/robottelo/issues{/number}","pulls_url":"https://api.github.com/repos/Ichimonji10/robottelo/pulls{/number}","milestones_url":"https://api.github.com/repos/Ichimonji10/robottelo/milestones{/number}","notifications_url":"https://api.github.com/repos/Ichimonji10/robottelo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ichimonji10/robottelo/labels{/name}","releases_url":"https://api.github.com/repos/Ichimonji10/robottelo/releases{/id}","created_at":"2014-06-06T14:38:05Z","updated_at":"2015-05-08T17:30:21Z","pushed_at":"2015-08-20T16:47:23Z","git_url":"git://github.com/Ichimonji10/robottelo.git","ssh_url":"git@github.com:Ichimonji10/robottelo.git","clone_url":"https://github.com/Ichimonji10/robottelo.git","svn_url":"https://github.com/Ichimonji10/robottelo","homepage":null,"size":12211,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"SatelliteQE:master","ref":"master","sha":"5cea836dfc4952267cca6c77d87c465f2133612b","user":{"login":"SatelliteQE","id":8754276,"avatar_url":"https://avatars.githubusercontent.com/u/8754276?v=3","gravatar_id":"","url":"https://api.github.com/users/SatelliteQE","html_url":"https://github.com/SatelliteQE","followers_url":"https://api.github.com/users/SatelliteQE/followers","following_url":"https://api.github.com/users/SatelliteQE/following{/other_user}","gists_url":"https://api.github.com/users/SatelliteQE/gists{/gist_id}","starred_url":"https://api.github.com/users/SatelliteQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SatelliteQE/subscriptions","organizations_url":"https://api.github.com/users/SatelliteQE/orgs","repos_url":"https://api.github.com/users/SatelliteQE/repos","events_url":"https://api.github.com/users/SatelliteQE/events{/privacy}","received_events_url":"https://api.github.com/users/SatelliteQE/received_events","type":"Organization","site_admin":false},"repo":{"id":4000279,"name":"robottelo","full_name":"SatelliteQE/robottelo","owner":{"login":"SatelliteQE","id":8754276,"avatar_url":"https://avatars.githubusercontent.com/u/8754276?v=3","gravatar_id":"","url":"https://api.github.com/users/SatelliteQE","html_url":"https://github.com/SatelliteQE","followers_url":"https://api.github.com/users/SatelliteQE/followers","following_url":"https://api.github.com/users/SatelliteQE/following{/other_user}","gists_url":"https://api.github.com/users/SatelliteQE/gists{/gist_id}","starred_url":"https://api.github.com/users/SatelliteQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SatelliteQE/subscriptions","organizations_url":"https://api.github.com/users/SatelliteQE/orgs","repos_url":"https://api.github.com/users/SatelliteQE/repos","events_url":"https://api.github.com/users/SatelliteQE/events{/privacy}","received_events_url":"https://api.github.com/users/SatelliteQE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SatelliteQE/robottelo","description":"Robottelo is a test suite which exercises The Foreman.","fork":false,"url":"https://api.github.com/repos/SatelliteQE/robottelo","forks_url":"https://api.github.com/repos/SatelliteQE/robottelo/forks","keys_url":"https://api.github.com/repos/SatelliteQE/robottelo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SatelliteQE/robottelo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SatelliteQE/robottelo/teams","hooks_url":"https://api.github.com/repos/SatelliteQE/robottelo/hooks","issue_events_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/events{/number}","events_url":"https://api.github.com/repos/SatelliteQE/robottelo/events","assignees_url":"https://api.github.com/repos/SatelliteQE/robottelo/assignees{/user}","branches_url":"https://api.github.com/repos/SatelliteQE/robottelo/branches{/branch}","tags_url":"https://api.github.com/repos/SatelliteQE/robottelo/tags","blobs_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/refs{/sha}","trees_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/{sha}","languages_url":"https://api.github.com/repos/SatelliteQE/robottelo/languages","stargazers_url":"https://api.github.com/repos/SatelliteQE/robottelo/stargazers","contributors_url":"https://api.github.com/repos/SatelliteQE/robottelo/contributors","subscribers_url":"https://api.github.com/repos/SatelliteQE/robottelo/subscribers","subscription_url":"https://api.github.com/repos/SatelliteQE/robottelo/subscription","commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/commits{/sha}","git_commits_url":"https://api.github.com/repos/SatelliteQE/robottelo/git/commits{/sha}","comments_url":"https://api.github.com/repos/SatelliteQE/robottelo/comments{/number}","issue_comment_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues/comments{/number}","contents_url":"https://api.github.com/repos/SatelliteQE/robottelo/contents/{+path}","compare_url":"https://api.github.com/repos/SatelliteQE/robottelo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SatelliteQE/robottelo/merges","archive_url":"https://api.github.com/repos/SatelliteQE/robottelo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SatelliteQE/robottelo/downloads","issues_url":"https://api.github.com/repos/SatelliteQE/robottelo/issues{/number}","pulls_url":"https://api.github.com/repos/SatelliteQE/robottelo/pulls{/number}","milestones_url":"https://api.github.com/repos/SatelliteQE/robottelo/milestones{/number}","notifications_url":"https://api.github.com/repos/SatelliteQE/robottelo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SatelliteQE/robottelo/labels{/name}","releases_url":"https://api.github.com/repos/SatelliteQE/robottelo/releases{/id}","created_at":"2012-04-12T01:36:39Z","updated_at":"2015-08-04T16:49:37Z","pushed_at":"2015-08-20T19:51:08Z","git_url":"git://github.com/SatelliteQE/robottelo.git","ssh_url":"git@github.com:SatelliteQE/robottelo.git","clone_url":"https://github.com/SatelliteQE/robottelo.git","svn_url":"https://github.com/SatelliteQE/robottelo","homepage":"","size":18734,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":208,"forks":29,"open_issues":208,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695"},"html":{"href":"https://github.com/SatelliteQE/robottelo/pull/2695"},"issue":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2695"},"comments":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/issues/2695/comments"},"review_comments":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695/comments"},"review_comment":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/pulls/2695/commits"},"statuses":{"href":"https://api.github.com/repos/SatelliteQE/robottelo/statuses/ad8563c665fdb5de9d1215db704fddf44e2766a6"}}}}