{"action":"created","comment":{"url":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/comments/240760533","pull_request_review_id":183864787,"id":240760533,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDc2MDUzMw==","diff_hunk":"@@ -369,3 +374,135 @@ def test_consume_halt_without_exitcode(self, mock_consume, mock_importlib):\n         mock_importlib.import_module.called_once_with(\"mod\")\n         mock_consume.assert_called_once_with(mock_mod_with_callable.callable, \"b\")\n         self.assertEqual(0, result.exit_code)\n+\n+\n+class PublishCliTests(unittest.TestCase):\n+    \"\"\"Unit tests for the 'publish' command of the CLI.\"\"\"\n+\n+    def setUp(self):\n+        self.runner = CliRunner()\n+\n+    @mock.patch(\"fedora_messaging.cli.api.publish\")\n+    def test_correct_msg_in_file(self, mock_publish):\n+        \"\"\"Assert providing path to file with correct message via the CLI works.\"\"\"\n+        cli_options = {\"file\": GOOD_MSG_DUMP, \"exchange\": \"test_pe\"}\n+        result = self.runner.invoke(\n+            cli.cli,\n+            [\n+                \"--conf=\" + GOOD_CONF,\n+                \"publish\",\n+                \"--exchange=\" + cli_options[\"exchange\"],\n+                cli_options[\"file\"],\n+            ],\n+        )\n+        self.assertIn(\"Sending message with topic test_topic\", result.output)\n+        mock_publish.assert_called_once()\n+        self.assertEqual(mock_publish.call_args_list[0][0][0].topic, \"test_topic\")","path":"fedora_messaging/tests/unit/test_cli.py","position":46,"original_position":46,"commit_id":"892ef22297f43406dbe69286767e77631d26a9ca","original_commit_id":"92e7f1a047ba7263f763f1bc146e44d1818adcd3","user":{"login":"jeremycline","id":1977525,"node_id":"MDQ6VXNlcjE5Nzc1MjU=","avatar_url":"https://avatars1.githubusercontent.com/u/1977525?v=4","gravatar_id":"","url":"https://api.github.com/users/jeremycline","html_url":"https://github.com/jeremycline","followers_url":"https://api.github.com/users/jeremycline/followers","following_url":"https://api.github.com/users/jeremycline/following{/other_user}","gists_url":"https://api.github.com/users/jeremycline/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremycline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremycline/subscriptions","organizations_url":"https://api.github.com/users/jeremycline/orgs","repos_url":"https://api.github.com/users/jeremycline/repos","events_url":"https://api.github.com/users/jeremycline/events{/privacy}","received_events_url":"https://api.github.com/users/jeremycline/received_events","type":"User","site_admin":false},"body":"True, although you could set the ``expected_msg._headers[\"sent-at\"]`` to be the same as the fixture message","created_at":"2018-12-11T19:33:57Z","updated_at":"2018-12-11T19:33:57Z","html_url":"https://github.com/fedora-infra/fedora-messaging/pull/43#discussion_r240760533","pull_request_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/comments/240760533"},"html":{"href":"https://github.com/fedora-infra/fedora-messaging/pull/43#discussion_r240760533"},"pull_request":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43"}},"in_reply_to_id":239101244},"pull_request":{"url":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43","id":210393509,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwMzkzNTA5","html_url":"https://github.com/fedora-infra/fedora-messaging/pull/43","diff_url":"https://github.com/fedora-infra/fedora-messaging/pull/43.diff","patch_url":"https://github.com/fedora-infra/fedora-messaging/pull/43.patch","issue_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/issues/43","number":43,"state":"open","locked":false,"title":"new cli publish command","user":{"login":"sebwoj","id":42519683,"node_id":"MDQ6VXNlcjQyNTE5Njgz","avatar_url":"https://avatars1.githubusercontent.com/u/42519683?v=4","gravatar_id":"","url":"https://api.github.com/users/sebwoj","html_url":"https://github.com/sebwoj","followers_url":"https://api.github.com/users/sebwoj/followers","following_url":"https://api.github.com/users/sebwoj/following{/other_user}","gists_url":"https://api.github.com/users/sebwoj/gists{/gist_id}","starred_url":"https://api.github.com/users/sebwoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebwoj/subscriptions","organizations_url":"https://api.github.com/users/sebwoj/orgs","repos_url":"https://api.github.com/users/sebwoj/repos","events_url":"https://api.github.com/users/sebwoj/events{/privacy}","received_events_url":"https://api.github.com/users/sebwoj/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Sebastian Wojciechowski <s.wojciechowski89@gmail.com>\r\n\r\nIn test_good_conf, is it the good idea to check:\r\nmock_publish.assert_called_with(\r\n            api.Message(topic=None, body={None:None}), None\r\n        )\r\n\r\ninstead of creating anther patch ->\r\n@mock.patch(\"fedora_messaging.cli.api.Message\")\r\nand as return_value set mock_message, and han check:\r\nmock_publish.assert_called_with(\r\n            mock_mnessage, None\r\n        )\r\n","created_at":"2018-08-23T09:58:05Z","updated_at":"2018-12-11T19:33:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"708cd0336e3d642c6ddaa572c597e95ea994a49e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43/commits","review_comments_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43/comments","review_comment_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/issues/43/comments","statuses_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/statuses/892ef22297f43406dbe69286767e77631d26a9ca","head":{"label":"sebwoj:new_cli_publish_command","ref":"new_cli_publish_command","sha":"892ef22297f43406dbe69286767e77631d26a9ca","user":{"login":"sebwoj","id":42519683,"node_id":"MDQ6VXNlcjQyNTE5Njgz","avatar_url":"https://avatars1.githubusercontent.com/u/42519683?v=4","gravatar_id":"","url":"https://api.github.com/users/sebwoj","html_url":"https://github.com/sebwoj","followers_url":"https://api.github.com/users/sebwoj/followers","following_url":"https://api.github.com/users/sebwoj/following{/other_user}","gists_url":"https://api.github.com/users/sebwoj/gists{/gist_id}","starred_url":"https://api.github.com/users/sebwoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebwoj/subscriptions","organizations_url":"https://api.github.com/users/sebwoj/orgs","repos_url":"https://api.github.com/users/sebwoj/repos","events_url":"https://api.github.com/users/sebwoj/events{/privacy}","received_events_url":"https://api.github.com/users/sebwoj/received_events","type":"User","site_admin":false},"repo":{"id":145324857,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUzMjQ4NTc=","name":"fedora-messaging","full_name":"sebwoj/fedora-messaging","private":false,"owner":{"login":"sebwoj","id":42519683,"node_id":"MDQ6VXNlcjQyNTE5Njgz","avatar_url":"https://avatars1.githubusercontent.com/u/42519683?v=4","gravatar_id":"","url":"https://api.github.com/users/sebwoj","html_url":"https://github.com/sebwoj","followers_url":"https://api.github.com/users/sebwoj/followers","following_url":"https://api.github.com/users/sebwoj/following{/other_user}","gists_url":"https://api.github.com/users/sebwoj/gists{/gist_id}","starred_url":"https://api.github.com/users/sebwoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebwoj/subscriptions","organizations_url":"https://api.github.com/users/sebwoj/orgs","repos_url":"https://api.github.com/users/sebwoj/repos","events_url":"https://api.github.com/users/sebwoj/events{/privacy}","received_events_url":"https://api.github.com/users/sebwoj/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sebwoj/fedora-messaging","description":"A library for sending AMQP messages with JSON schema in Fedora infrastructure","fork":true,"url":"https://api.github.com/repos/sebwoj/fedora-messaging","forks_url":"https://api.github.com/repos/sebwoj/fedora-messaging/forks","keys_url":"https://api.github.com/repos/sebwoj/fedora-messaging/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sebwoj/fedora-messaging/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sebwoj/fedora-messaging/teams","hooks_url":"https://api.github.com/repos/sebwoj/fedora-messaging/hooks","issue_events_url":"https://api.github.com/repos/sebwoj/fedora-messaging/issues/events{/number}","events_url":"https://api.github.com/repos/sebwoj/fedora-messaging/events","assignees_url":"https://api.github.com/repos/sebwoj/fedora-messaging/assignees{/user}","branches_url":"https://api.github.com/repos/sebwoj/fedora-messaging/branches{/branch}","tags_url":"https://api.github.com/repos/sebwoj/fedora-messaging/tags","blobs_url":"https://api.github.com/repos/sebwoj/fedora-messaging/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sebwoj/fedora-messaging/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sebwoj/fedora-messaging/git/refs{/sha}","trees_url":"https://api.github.com/repos/sebwoj/fedora-messaging/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sebwoj/fedora-messaging/statuses/{sha}","languages_url":"https://api.github.com/repos/sebwoj/fedora-messaging/languages","stargazers_url":"https://api.github.com/repos/sebwoj/fedora-messaging/stargazers","contributors_url":"https://api.github.com/repos/sebwoj/fedora-messaging/contributors","subscribers_url":"https://api.github.com/repos/sebwoj/fedora-messaging/subscribers","subscription_url":"https://api.github.com/repos/sebwoj/fedora-messaging/subscription","commits_url":"https://api.github.com/repos/sebwoj/fedora-messaging/commits{/sha}","git_commits_url":"https://api.github.com/repos/sebwoj/fedora-messaging/git/commits{/sha}","comments_url":"https://api.github.com/repos/sebwoj/fedora-messaging/comments{/number}","issue_comment_url":"https://api.github.com/repos/sebwoj/fedora-messaging/issues/comments{/number}","contents_url":"https://api.github.com/repos/sebwoj/fedora-messaging/contents/{+path}","compare_url":"https://api.github.com/repos/sebwoj/fedora-messaging/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sebwoj/fedora-messaging/merges","archive_url":"https://api.github.com/repos/sebwoj/fedora-messaging/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sebwoj/fedora-messaging/downloads","issues_url":"https://api.github.com/repos/sebwoj/fedora-messaging/issues{/number}","pulls_url":"https://api.github.com/repos/sebwoj/fedora-messaging/pulls{/number}","milestones_url":"https://api.github.com/repos/sebwoj/fedora-messaging/milestones{/number}","notifications_url":"https://api.github.com/repos/sebwoj/fedora-messaging/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sebwoj/fedora-messaging/labels{/name}","releases_url":"https://api.github.com/repos/sebwoj/fedora-messaging/releases{/id}","deployments_url":"https://api.github.com/repos/sebwoj/fedora-messaging/deployments","created_at":"2018-08-19T17:41:47Z","updated_at":"2018-12-08T21:13:30Z","pushed_at":"2018-12-08T21:13:28Z","git_url":"git://github.com/sebwoj/fedora-messaging.git","ssh_url":"git@github.com:sebwoj/fedora-messaging.git","clone_url":"https://github.com/sebwoj/fedora-messaging.git","svn_url":"https://github.com/sebwoj/fedora-messaging","homepage":"","size":459,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fedora-infra:master","ref":"master","sha":"d78292b79408ab3f35f92a07c900fd10d160beca","user":{"login":"fedora-infra","id":3316637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTY2Mzc=","avatar_url":"https://avatars1.githubusercontent.com/u/3316637?v=4","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"repo":{"id":132087972,"node_id":"MDEwOlJlcG9zaXRvcnkxMzIwODc5NzI=","name":"fedora-messaging","full_name":"fedora-infra/fedora-messaging","private":false,"owner":{"login":"fedora-infra","id":3316637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTY2Mzc=","avatar_url":"https://avatars1.githubusercontent.com/u/3316637?v=4","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/fedora-infra/fedora-messaging","description":"A library for sending AMQP messages with JSON schema in Fedora infrastructure","fork":false,"url":"https://api.github.com/repos/fedora-infra/fedora-messaging","forks_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/forks","keys_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/teams","hooks_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/hooks","issue_events_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/issues/events{/number}","events_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/events","assignees_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/assignees{/user}","branches_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/branches{/branch}","tags_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/tags","blobs_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/git/refs{/sha}","trees_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/statuses/{sha}","languages_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/languages","stargazers_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/stargazers","contributors_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/contributors","subscribers_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/subscribers","subscription_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/subscription","commits_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/commits{/sha}","git_commits_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/git/commits{/sha}","comments_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/comments{/number}","issue_comment_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/issues/comments{/number}","contents_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/contents/{+path}","compare_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/merges","archive_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/downloads","issues_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/issues{/number}","pulls_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls{/number}","milestones_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/milestones{/number}","notifications_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/labels{/name}","releases_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/releases{/id}","deployments_url":"https://api.github.com/repos/fedora-infra/fedora-messaging/deployments","created_at":"2018-05-04T04:42:33Z","updated_at":"2018-12-07T16:45:00Z","pushed_at":"2018-12-07T16:44:58Z","git_url":"git://github.com/fedora-infra/fedora-messaging.git","ssh_url":"git@github.com:fedora-infra/fedora-messaging.git","clone_url":"https://github.com/fedora-infra/fedora-messaging.git","svn_url":"https://github.com/fedora-infra/fedora-messaging","homepage":"","size":457,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":9,"open_issues":5,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43"},"html":{"href":"https://github.com/fedora-infra/fedora-messaging/pull/43"},"issue":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/issues/43"},"comments":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/fedora-infra/fedora-messaging/statuses/892ef22297f43406dbe69286767e77631d26a9ca"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jeremycline"}}