{"action":"created","comment":{"url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/comments/71714781","id":71714781,"diff_hunk":"@@ -149,6 +149,78 @@ def _get_pkglist(update):\n     return out_pkglist\n \n \n+class UploadDrpmTestCase(utils.BaseAPITestCase):\n+    \"\"\"Test whether one can upload and associate DRPMs.\"\"\"\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        \"\"\"Upload DRPM to a repo.\n+\n+        Steps:\n+\n+        1. Create a RPM repo.\n+        2. Upload DRPM to repo.\n+        3. Check if DRPM has been\"uploaded.\n+\n+        https://github.com/PulpQE/pulp-smash/issues/336\n+        \"\"\"\n+        super(UploadDrpmTestCase, cls).setUpClass()\n+        cls.responses = {}\n+\n+        # init repo and client\n+        client = api.Client(cls.cfg, api.json_handler)\n+        repo = client.post(REPOSITORY_PATH, gen_repo())\n+        cls.resources.add(repo['_href'])\n+        client.response_handler = api.safe_handler\n+\n+        # Download DRPM\n+        cls.drpm = utils.http_get(DRPM_URL)\n+\n+        # Start upload\n+        cls.responses['malloc'] = client.post(CONTENT_UPLOAD_PATH)\n+        cls.responses['upload'] = client.put(\n+            urljoin(cls.responses['malloc'].json()['_href'], '0/'),\n+            data=cls.drpm,\n+        )\n+        cls.responses['import'] = client.post(\n+            urljoin(repo['_href'], 'actions/import_upload/'),\n+            {\n+                'unit_key': {},\n+                'unit_type_id': 'drpm',\n+                'upload_id': cls.responses['malloc'].json()['upload_id'],\n+            },\n+        )\n+        # Remove upload task\n+        cls.responses['free'] = client.delete(\n+            cls.responses['malloc'].json()['_href'],\n+        )\n+\n+        # Search for drpm to determine if is present\n+        body = {'criteria': {}}\n+        cls.responses['repo units'] = client.post(urljoin(repo['_href'], 'search/units/'), body)\n+\n+    def test_status_code(self):\n+        \"\"\"Verify the HTTP status code of each server response.\"\"\"\n+        for step, code in (\n+                ('malloc', 201),\n+                ('upload', 200),\n+                ('import', 202),\n+                ('free', 200),\n+                ('repo units', 200),\n+        ):\n+            with self.subTest(step=step):\n+                self.assertEqual(self.responses[step].status_code, code)\n+\n+    def test_drpm_uploaded_successfully(self):\n+        \"\"\"Test if DRPM has been uploaded successfully.\"\"\"\n+        self.assertEqual(len(self.responses['repo units'].json()), 1)\n+\n+    def test_drpm_file_name_is_correct(self):\n+        \"\"\"Test if DRPM extracted correctly metadata for createing filename.\"\"\"\n+        fname = self.responses['repo units'].json()[0]['metadata']['filename']\n+        self.assertEqual(fname, 'drpms/yum-3.4.3-10.fc16_3.4.3-11.fc16.noarch.drpm')","path":"pulp_smash/tests/rpm/api_v2/test_upload_publish.py","position":82,"original_position":82,"commit_id":"8b5795649cec52dbc797bfe50f7b5949f3f52067","original_commit_id":"8b5795649cec52dbc797bfe50f7b5949f3f52067","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":"Can we use a constant here instead of hard-coding this string?","created_at":"2016-07-21T14:24:48Z","updated_at":"2016-07-21T14:24:48Z","html_url":"https://github.com/PulpQE/pulp-smash/pull/337#discussion_r71714781","pull_request_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/337","_links":{"self":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/comments/71714781"},"html":{"href":"https://github.com/PulpQE/pulp-smash/pull/337#discussion_r71714781"},"pull_request":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/337"}}},"pull_request":{"url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/337","id":78320346,"html_url":"https://github.com/PulpQE/pulp-smash/pull/337","diff_url":"https://github.com/PulpQE/pulp-smash/pull/337.diff","patch_url":"https://github.com/PulpQE/pulp-smash/pull/337.patch","issue_url":"https://api.github.com/repos/PulpQE/pulp-smash/issues/337","number":337,"state":"open","locked":false,"title":"Issue #336 - Test uploading DRPMs","user":{"login":"BrnoPCmaniak","id":1249759,"avatar_url":"https://avatars.githubusercontent.com/u/1249759?v=3","gravatar_id":"","url":"https://api.github.com/users/BrnoPCmaniak","html_url":"https://github.com/BrnoPCmaniak","followers_url":"https://api.github.com/users/BrnoPCmaniak/followers","following_url":"https://api.github.com/users/BrnoPCmaniak/following{/other_user}","gists_url":"https://api.github.com/users/BrnoPCmaniak/gists{/gist_id}","starred_url":"https://api.github.com/users/BrnoPCmaniak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrnoPCmaniak/subscriptions","organizations_url":"https://api.github.com/users/BrnoPCmaniak/orgs","repos_url":"https://api.github.com/users/BrnoPCmaniak/repos","events_url":"https://api.github.com/users/BrnoPCmaniak/events{/privacy}","received_events_url":"https://api.github.com/users/BrnoPCmaniak/received_events","type":"User","site_admin":false},"body":"Added:\r\n * pulp_smash.constans - DRPM, DRPM_URL\r\n * pulp_smash.tests.rpm.api_v2.test_upload_publish.UploadDrpmTestCase - API\r\n * pulp_smash.tests.rpm.cli.test_upload - Client\r\n * Added docs for pulp_smash.tests.rpm.cli.test_upload","created_at":"2016-07-21T13:57:54Z","updated_at":"2016-07-21T14:24:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"852ca0077f0a4d1ede82b353ef35b6bcc1656271","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/337/commits","review_comments_url":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/337/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/337/comments","statuses_url":"https://api.github.com/repos/PulpQE/pulp-smash/statuses/8b5795649cec52dbc797bfe50f7b5949f3f52067","head":{"label":"BrnoPCmaniak:story-1806","ref":"story-1806","sha":"8b5795649cec52dbc797bfe50f7b5949f3f52067","user":{"login":"BrnoPCmaniak","id":1249759,"avatar_url":"https://avatars.githubusercontent.com/u/1249759?v=3","gravatar_id":"","url":"https://api.github.com/users/BrnoPCmaniak","html_url":"https://github.com/BrnoPCmaniak","followers_url":"https://api.github.com/users/BrnoPCmaniak/followers","following_url":"https://api.github.com/users/BrnoPCmaniak/following{/other_user}","gists_url":"https://api.github.com/users/BrnoPCmaniak/gists{/gist_id}","starred_url":"https://api.github.com/users/BrnoPCmaniak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrnoPCmaniak/subscriptions","organizations_url":"https://api.github.com/users/BrnoPCmaniak/orgs","repos_url":"https://api.github.com/users/BrnoPCmaniak/repos","events_url":"https://api.github.com/users/BrnoPCmaniak/events{/privacy}","received_events_url":"https://api.github.com/users/BrnoPCmaniak/received_events","type":"User","site_admin":false},"repo":{"id":63417307,"name":"pulp-smash","full_name":"BrnoPCmaniak/pulp-smash","owner":{"login":"BrnoPCmaniak","id":1249759,"avatar_url":"https://avatars.githubusercontent.com/u/1249759?v=3","gravatar_id":"","url":"https://api.github.com/users/BrnoPCmaniak","html_url":"https://github.com/BrnoPCmaniak","followers_url":"https://api.github.com/users/BrnoPCmaniak/followers","following_url":"https://api.github.com/users/BrnoPCmaniak/following{/other_user}","gists_url":"https://api.github.com/users/BrnoPCmaniak/gists{/gist_id}","starred_url":"https://api.github.com/users/BrnoPCmaniak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrnoPCmaniak/subscriptions","organizations_url":"https://api.github.com/users/BrnoPCmaniak/orgs","repos_url":"https://api.github.com/users/BrnoPCmaniak/repos","events_url":"https://api.github.com/users/BrnoPCmaniak/events{/privacy}","received_events_url":"https://api.github.com/users/BrnoPCmaniak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BrnoPCmaniak/pulp-smash","description":"A GPL-licensed Python library that facilitates easy testing of Pulp.","fork":true,"url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash","forks_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/forks","keys_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/teams","hooks_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/hooks","issue_events_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/issues/events{/number}","events_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/events","assignees_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/assignees{/user}","branches_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/branches{/branch}","tags_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/tags","blobs_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/statuses/{sha}","languages_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/languages","stargazers_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/stargazers","contributors_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/contributors","subscribers_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/subscribers","subscription_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/subscription","commits_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/contents/{+path}","compare_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/merges","archive_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/downloads","issues_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/issues{/number}","pulls_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/pulls{/number}","milestones_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/milestones{/number}","notifications_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/labels{/name}","releases_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/releases{/id}","deployments_url":"https://api.github.com/repos/BrnoPCmaniak/pulp-smash/deployments","created_at":"2016-07-15T11:33:39Z","updated_at":"2016-07-15T11:33:40Z","pushed_at":"2016-07-21T13:56:51Z","git_url":"git://github.com/BrnoPCmaniak/pulp-smash.git","ssh_url":"git@github.com:BrnoPCmaniak/pulp-smash.git","clone_url":"https://github.com/BrnoPCmaniak/pulp-smash.git","svn_url":"https://github.com/BrnoPCmaniak/pulp-smash","homepage":null,"size":891,"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":"e31f7b9b6960a0c62b547ec1e40a3d0bd08a573f","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-07-15T01:48:32Z","pushed_at":"2016-07-21T13:57:54Z","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":1051,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":62,"forks":24,"open_issues":62,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/337"},"html":{"href":"https://github.com/PulpQE/pulp-smash/pull/337"},"issue":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/issues/337"},"comments":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/issues/337/comments"},"review_comments":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/pulls/337/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/337/commits"},"statuses":{"href":"https://api.github.com/repos/PulpQE/pulp-smash/statuses/8b5795649cec52dbc797bfe50f7b5949f3f52067"}}}}
{"actor":{"display_login":"Ichimonji10"}}