{"action":"created","comment":{"url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/comments/66988607","id":66988607,"diff_hunk":"@@ -0,0 +1,97 @@\n+# coding=utf-8\n+\"\"\"Tests for list/refresh/delete content sources.\"\"\"\n+from __future__ import unicode_literals\n+\n+import unittest2\n+from packaging.version import Version\n+\n+from pulp_smash import cli, config\n+from pulp_smash.constants import CONTENT_SOURCE_ID\n+\n+\n+def _get_content_source_ids(server_config):\n+    \"\"\"Get the id list of all content sources, or None if the list is empty.\n+\n+    :param server_config: pulp_smash.config.ServerConfig server_config:\n+        Information about the Pulp server being targeted.\n+    :return: None if the list of content sources is empty, or the IDs of all\n+        content sources as ``list``.\n+    \"\"\"\n+    keyword = 'Source Id:'\n+    completed_proc = cli.Client(server_config).run(\n+        'pulp-admin content sources list'.split()\n+    )\n+    lines = [\n+        line for line in completed_proc.stdout.splitlines()\n+        if keyword in line\n+    ]\n+    assert len(lines) >= 0\n+    if len(lines) == 0:\n+        return None\n+    return [line.split(keyword)[1].strip() for line in lines]\n+\n+\n+class RefreshAndDeleteContentSourcesTestCase(unittest2.TestCase):\n+    \"\"\"Test whether pulp-admin client can refresh and delete content source.\n+\n+    This test case targets Pulp #1692`_ and `Pulp Smash #141`_. The\n+    `content sources`_ documentation describes the CLI syntax. The\n+    test steps are as follows:\n+\n+    1. Create configuration file of a content source.\n+    2. Check whether the content sources list is empty.\n+    3. Refresh all content sources. Verify no errors are reported.\n+    4. Refresh a specified content source. Verify no errors are reported.\n+    5. Remove the specified content source. Verify that the source is\n+        actually deleted.\n+\n+    .. _Pulp #1692:  https://pulp.plan.io/issues/1692\n+    .. _Pulp Smash #141: https://github.com/PulpQE/pulp-smash/issues/141\n+    .. _content sources:\n+        http://pulp.readthedocs.io/en/latest/user-guide/content-sources.html\n+    \"\"\"\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        \"\"\"Verify if content resources exist.\"\"\"\n+        cls.cfg = config.get_config()\n+        if cls.cfg.version < Version('2.9'):\n+            raise unittest2.SkipTest('This test requires Pulp 2.9 or greater.')\n+        cls.client = cli.Client(cls.cfg)\n+        cls.source_id = CONTENT_SOURCE_ID\n+        cls.source_ids = _get_content_source_ids(cls.cfg)","path":"pulp_smash/tests/platform/cli/test_content_sources.py","position":62,"original_position":62,"commit_id":"1bbf12579c43e8f202c2d67df5b7f6c6242b368c","original_commit_id":"1bbf12579c43e8f202c2d67df5b7f6c6242b368c","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":"`cls.source_ids` is only referenced in this one method. Is there a reason to make it a class attribute?","created_at":"2016-06-14T15:03:33Z","updated_at":"2016-06-14T15:03:33Z","html_url":"https://github.com/PulpQE/pulp-smash/pull/305#discussion_r66988607","pull_request_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305","_links":{"self":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/comments/66988607"},"html":{"href":"https://github.com/PulpQE/pulp-smash/pull/305#discussion_r66988607"},"pull_request":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305"}}},"pull_request":{"url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305","id":73610527,"html_url":"https://github.com/PulpQE/pulp-smash/pull/305","diff_url":"https://github.com/PulpQE/pulp-smash/pull/305.diff","patch_url":"https://github.com/PulpQE/pulp-smash/pull/305.patch","issue_url":"https://api.github.com/repos/PulpQE/pulp-smash/issues/305","number":305,"state":"open","locked":false,"title":"Fix up Pulp Smash #141","user":{"login":"danuzclaudes","id":8943359,"avatar_url":"https://avatars.githubusercontent.com/u/8943359?v=3","gravatar_id":"","url":"https://api.github.com/users/danuzclaudes","html_url":"https://github.com/danuzclaudes","followers_url":"https://api.github.com/users/danuzclaudes/followers","following_url":"https://api.github.com/users/danuzclaudes/following{/other_user}","gists_url":"https://api.github.com/users/danuzclaudes/gists{/gist_id}","starred_url":"https://api.github.com/users/danuzclaudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danuzclaudes/subscriptions","organizations_url":"https://api.github.com/users/danuzclaudes/orgs","repos_url":"https://api.github.com/users/danuzclaudes/repos","events_url":"https://api.github.com/users/danuzclaudes/events{/privacy}","received_events_url":"https://api.github.com/users/danuzclaudes/received_events","type":"User","site_admin":false},"body":"This commit fixes the issue: https://github.com/PulpQE/pulp-smash/issues/141.\r\n\r\nIt checks if there exists a content source, refresh either all sources or a\r\nspecified source, and delete a specified source.\r\n\r\nThis commit has created a new module: `pulp_smash.tests.platform.cli`.\r\n\r\nTest output:\r\n\r\n```\r\n[vagrant@dev pulp-smash]$ python -m unittest pulp_smash.tests.platform.cli.test_content_sources.RefreshAndDeleteContentSourcesTestCase\r\n2.9.0b1\r\nE\r\n======================================================================\r\nERROR: setUpClass (pulp_smash.tests.platform.cli.test_content_sources.RefreshAndDeleteContentSourcesTestCase)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"pulp_smash/tests/platform/cli/test_content_sources.py\", line 60, in setUpClass\r\n    raise unittest2.SkipTest('This test requires Pulp 2.9 or greater.')\r\nSkipTest: This test requires Pulp 2.9 or greater.\r\n\r\n----------------------------------------------------------------------\r\nRan 0 tests in 0.001s\r\n\r\nFAILED (errors=1)\r\n\r\n```","created_at":"2016-06-13T17:10:15Z","updated_at":"2016-06-14T15:03:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d005b09bfb52f4ef3faadd196a2adcaac7e9199","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305/commits","review_comments_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305/comments","review_comment_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PulpQE/pulp-smash/issues/305/comments","statuses_url":"https://api.github.com/repos/PulpQE/pulp-smash/statuses/1bbf12579c43e8f202c2d67df5b7f6c6242b368c","head":{"label":"danuzclaudes:2.9-issue-141","ref":"2.9-issue-141","sha":"1bbf12579c43e8f202c2d67df5b7f6c6242b368c","user":{"login":"danuzclaudes","id":8943359,"avatar_url":"https://avatars.githubusercontent.com/u/8943359?v=3","gravatar_id":"","url":"https://api.github.com/users/danuzclaudes","html_url":"https://github.com/danuzclaudes","followers_url":"https://api.github.com/users/danuzclaudes/followers","following_url":"https://api.github.com/users/danuzclaudes/following{/other_user}","gists_url":"https://api.github.com/users/danuzclaudes/gists{/gist_id}","starred_url":"https://api.github.com/users/danuzclaudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danuzclaudes/subscriptions","organizations_url":"https://api.github.com/users/danuzclaudes/orgs","repos_url":"https://api.github.com/users/danuzclaudes/repos","events_url":"https://api.github.com/users/danuzclaudes/events{/privacy}","received_events_url":"https://api.github.com/users/danuzclaudes/received_events","type":"User","site_admin":false},"repo":{"id":60041536,"name":"pulp-smash","full_name":"danuzclaudes/pulp-smash","owner":{"login":"danuzclaudes","id":8943359,"avatar_url":"https://avatars.githubusercontent.com/u/8943359?v=3","gravatar_id":"","url":"https://api.github.com/users/danuzclaudes","html_url":"https://github.com/danuzclaudes","followers_url":"https://api.github.com/users/danuzclaudes/followers","following_url":"https://api.github.com/users/danuzclaudes/following{/other_user}","gists_url":"https://api.github.com/users/danuzclaudes/gists{/gist_id}","starred_url":"https://api.github.com/users/danuzclaudes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danuzclaudes/subscriptions","organizations_url":"https://api.github.com/users/danuzclaudes/orgs","repos_url":"https://api.github.com/users/danuzclaudes/repos","events_url":"https://api.github.com/users/danuzclaudes/events{/privacy}","received_events_url":"https://api.github.com/users/danuzclaudes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danuzclaudes/pulp-smash","description":"A GPL-licensed Python library that facilitates easy testing of Pulp.","fork":true,"url":"https://api.github.com/repos/danuzclaudes/pulp-smash","forks_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/forks","keys_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/teams","hooks_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/hooks","issue_events_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/issues/events{/number}","events_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/events","assignees_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/assignees{/user}","branches_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/branches{/branch}","tags_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/tags","blobs_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/git/refs{/sha}","trees_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/statuses/{sha}","languages_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/languages","stargazers_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/stargazers","contributors_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/contributors","subscribers_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/subscribers","subscription_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/subscription","commits_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/commits{/sha}","git_commits_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/git/commits{/sha}","comments_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/comments{/number}","issue_comment_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/issues/comments{/number}","contents_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/contents/{+path}","compare_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/merges","archive_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/downloads","issues_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/issues{/number}","pulls_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/pulls{/number}","milestones_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/milestones{/number}","notifications_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/labels{/name}","releases_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/releases{/id}","deployments_url":"https://api.github.com/repos/danuzclaudes/pulp-smash/deployments","created_at":"2016-05-30T22:06:13Z","updated_at":"2016-05-30T22:06:14Z","pushed_at":"2016-06-14T14:44:44Z","git_url":"git://github.com/danuzclaudes/pulp-smash.git","ssh_url":"git@github.com:danuzclaudes/pulp-smash.git","clone_url":"https://github.com/danuzclaudes/pulp-smash.git","svn_url":"https://github.com/danuzclaudes/pulp-smash","homepage":null,"size":814,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"PulpQE:master","ref":"master","sha":"40364ad980021f5e492e52d0f16f4346b12f8862","user":{"login":"PulpQE","id":14839747,"avatar_url":"https://avatars.githubusercontent.com/u/14839747?v=3","gravatar_id":"","url":"https://api.github.com/users/PulpQE","html_url":"https://github.com/PulpQE","followers_url":"https://api.github.com/users/PulpQE/followers","following_url":"https://api.github.com/users/PulpQE/following{/other_user}","gists_url":"https://api.github.com/users/PulpQE/gists{/gist_id}","starred_url":"https://api.github.com/users/PulpQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PulpQE/subscriptions","organizations_url":"https://api.github.com/users/PulpQE/orgs","repos_url":"https://api.github.com/users/PulpQE/repos","events_url":"https://api.github.com/users/PulpQE/events{/privacy}","received_events_url":"https://api.github.com/users/PulpQE/received_events","type":"Organization","site_admin":false},"repo":{"id":43852872,"name":"pulp-smash","full_name":"PulpQE/pulp-smash","owner":{"login":"PulpQE","id":14839747,"avatar_url":"https://avatars.githubusercontent.com/u/14839747?v=3","gravatar_id":"","url":"https://api.github.com/users/PulpQE","html_url":"https://github.com/PulpQE","followers_url":"https://api.github.com/users/PulpQE/followers","following_url":"https://api.github.com/users/PulpQE/following{/other_user}","gists_url":"https://api.github.com/users/PulpQE/gists{/gist_id}","starred_url":"https://api.github.com/users/PulpQE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PulpQE/subscriptions","organizations_url":"https://api.github.com/users/PulpQE/orgs","repos_url":"https://api.github.com/users/PulpQE/repos","events_url":"https://api.github.com/users/PulpQE/events{/privacy}","received_events_url":"https://api.github.com/users/PulpQE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PulpQE/pulp-smash","description":"A GPL-licensed Python library that facilitates easy testing of Pulp.","fork":false,"url":"https://api.github.com/repos/PulpQE/pulp-smash","forks_url":"https://api.github.com/repos/PulpQE/pulp-smash/forks","keys_url":"https://api.github.com/repos/PulpQE/pulp-smash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PulpQE/pulp-smash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PulpQE/pulp-smash/teams","hooks_url":"https://api.github.com/repos/PulpQE/pulp-smash/hooks","issue_events_url":"https://api.github.com/repos/PulpQE/pulp-smash/issues/events{/number}","events_url":"https://api.github.com/repos/PulpQE/pulp-smash/events","assignees_url":"https://api.github.com/repos/PulpQE/pulp-smash/assignees{/user}","branches_url":"https://api.github.com/repos/PulpQE/pulp-smash/branches{/branch}","tags_url":"https://api.github.com/repos/PulpQE/pulp-smash/tags","blobs_url":"https://api.github.com/repos/PulpQE/pulp-smash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PulpQE/pulp-smash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PulpQE/pulp-smash/git/refs{/sha}","trees_url":"https://api.github.com/repos/PulpQE/pulp-smash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PulpQE/pulp-smash/statuses/{sha}","languages_url":"https://api.github.com/repos/PulpQE/pulp-smash/languages","stargazers_url":"https://api.github.com/repos/PulpQE/pulp-smash/stargazers","contributors_url":"https://api.github.com/repos/PulpQE/pulp-smash/contributors","subscribers_url":"https://api.github.com/repos/PulpQE/pulp-smash/subscribers","subscription_url":"https://api.github.com/repos/PulpQE/pulp-smash/subscription","commits_url":"https://api.github.com/repos/PulpQE/pulp-smash/commits{/sha}","git_commits_url":"https://api.github.com/repos/PulpQE/pulp-smash/git/commits{/sha}","comments_url":"https://api.github.com/repos/PulpQE/pulp-smash/comments{/number}","issue_comment_url":"https://api.github.com/repos/PulpQE/pulp-smash/issues/comments{/number}","contents_url":"https://api.github.com/repos/PulpQE/pulp-smash/contents/{+path}","compare_url":"https://api.github.com/repos/PulpQE/pulp-smash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PulpQE/pulp-smash/merges","archive_url":"https://api.github.com/repos/PulpQE/pulp-smash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PulpQE/pulp-smash/downloads","issues_url":"https://api.github.com/repos/PulpQE/pulp-smash/issues{/number}","pulls_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls{/number}","milestones_url":"https://api.github.com/repos/PulpQE/pulp-smash/milestones{/number}","notifications_url":"https://api.github.com/repos/PulpQE/pulp-smash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PulpQE/pulp-smash/labels{/name}","releases_url":"https://api.github.com/repos/PulpQE/pulp-smash/releases{/id}","deployments_url":"https://api.github.com/repos/PulpQE/pulp-smash/deployments","created_at":"2015-10-08T00:35:48Z","updated_at":"2016-04-29T00:26:20Z","pushed_at":"2016-06-14T14:27:00Z","git_url":"git://github.com/PulpQE/pulp-smash.git","ssh_url":"git@github.com:PulpQE/pulp-smash.git","clone_url":"https://github.com/PulpQE/pulp-smash.git","svn_url":"https://github.com/PulpQE/pulp-smash","homepage":null,"size":959,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":63,"forks":21,"open_issues":63,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305"},"html":{"href":"https://github.com/PulpQE/pulp-smash/pull/305"},"issue":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/issues/305"},"comments":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/issues/305/comments"},"review_comments":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305/comments"},"review_comment":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/305/commits"},"statuses":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/statuses/1bbf12579c43e8f202c2d67df5b7f6c6242b368c"}}}}
{"actor":{"display_login":"Ichimonji10"}}