{"action":"created","comment":{"url":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/comments/26907182","id":26907182,"diff_hunk":"@@ -1,15 +1,205 @@\n+import signal\n import unittest\n import mock\n-from notification_pusher import create_pidfile\n+import requests\n+import tarantool\n+from notification_pusher import notification_worker, done_with_processed_tasks, stop_handler, install_signal_handlers, \\\n+    SIGNAL_EXIT_CODE_OFFSET, main_loop, main, run, main_loop_run, run_application, mocked_run_application\n \n+__author__ = 'leshiy1295'\n \n class NotificationPusherTestCase(unittest.TestCase):\n-    def test_create_pidfile_example(self):\n-        pid = 42\n-        m_open = mock.mock_open()\n-        with mock.patch('notification_pusher.open', m_open, create=True):\n-            with mock.patch('os.getpid', mock.Mock(return_value=pid)):\n-                create_pidfile('/file/path')\n-\n-        m_open.assert_called_once_with('/file/path', 'w')\n-        m_open().write.assert_called_once_with(str(pid))\n+    def test_mocked_run_application(self):\n+        self.assertEqual(mocked_run_application(), run_application)\n+\n+    def test_notification_worker(self):\n+        task_mock = mock.Mock()\n+        task_mock.task_id = 1\n+        task_mock.data = {'callback_url': 'url'}\n+        task_queue_mock = mock.Mock()\n+        task_queue_mock.put = mock.Mock()\n+        current_thread_mock = mock.Mock()\n+        response_mock = mock.Mock()\n+        response_mock.status_code = 200\n+        mocked_method = mock.Mock()\n+        with mock.patch('notification_pusher.current_thread', mock.Mock(return_value=current_thread_mock), create=True):\n+            with mock.patch('notification_pusher.logger', mock.Mock(), create=True):\n+                with mock.patch('notification_pusher.requests.post', mock.Mock(return_value=response_mock), create=True):\n+                    with mock.patch('notification_pusher.my_mocked_method_for_test', mocked_method, create=True):\n+                        notification_worker(task_mock, task_queue_mock)\n+                        self.assertEqual(current_thread_mock.name, \"pusher.worker#1\")","path":"source/tests/test_notification_pusher.py","position":40,"original_position":40,"commit_id":"275833be49b001bf282f1772786311b972a2c0e0","original_commit_id":"275833be49b001bf282f1772786311b972a2c0e0","user":{"login":"bayandin","id":864213,"avatar_url":"https://avatars.githubusercontent.com/u/864213?v=3","gravatar_id":"","url":"https://api.github.com/users/bayandin","html_url":"https://github.com/bayandin","followers_url":"https://api.github.com/users/bayandin/followers","following_url":"https://api.github.com/users/bayandin/following{/other_user}","gists_url":"https://api.github.com/users/bayandin/gists{/gist_id}","starred_url":"https://api.github.com/users/bayandin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bayandin/subscriptions","organizations_url":"https://api.github.com/users/bayandin/orgs","repos_url":"https://api.github.com/users/bayandin/repos","events_url":"https://api.github.com/users/bayandin/events{/privacy}","received_events_url":"https://api.github.com/users/bayandin/received_events","type":"User","site_admin":false},"body":"Кажтеся, это можно было и не проверять.\r\nА лучше проверьте, что `notification_worker ` отправляет нужный запрос на нужный `callback_url`.","created_at":"2015-03-22T21:08:51Z","updated_at":"2015-03-22T21:08:51Z","html_url":"https://github.com/bayandin/home-assignment-1/pull/7#discussion_r26907182","pull_request_url":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/comments/26907182"},"html":{"href":"https://github.com/bayandin/home-assignment-1/pull/7#discussion_r26907182"},"pull_request":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7","id":31498149,"html_url":"https://github.com/bayandin/home-assignment-1/pull/7","diff_url":"https://github.com/bayandin/home-assignment-1/pull/7.diff","patch_url":"https://github.com/bayandin/home-assignment-1/pull/7.patch","issue_url":"https://api.github.com/repos/bayandin/home-assignment-1/issues/7","number":7,"state":"open","locked":false,"title":"Дз1","user":{"login":"DmitryDorofeev","id":6406737,"avatar_url":"https://avatars.githubusercontent.com/u/6406737?v=3","gravatar_id":"","url":"https://api.github.com/users/DmitryDorofeev","html_url":"https://github.com/DmitryDorofeev","followers_url":"https://api.github.com/users/DmitryDorofeev/followers","following_url":"https://api.github.com/users/DmitryDorofeev/following{/other_user}","gists_url":"https://api.github.com/users/DmitryDorofeev/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitryDorofeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitryDorofeev/subscriptions","organizations_url":"https://api.github.com/users/DmitryDorofeev/orgs","repos_url":"https://api.github.com/users/DmitryDorofeev/repos","events_url":"https://api.github.com/users/DmitryDorofeev/events{/privacy}","received_events_url":"https://api.github.com/users/DmitryDorofeev/received_events","type":"User","site_admin":false},"body":"Команда:\r\nДорофеев Дмитрий\r\nХалайджи Алексей","created_at":"2015-03-19T06:20:58Z","updated_at":"2015-03-22T21:08:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ea247c149d15c6e2dba9ed1e8b2836bde3b6d24","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7/commits","review_comments_url":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7/comments","review_comment_url":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bayandin/home-assignment-1/issues/7/comments","statuses_url":"https://api.github.com/repos/bayandin/home-assignment-1/statuses/275833be49b001bf282f1772786311b972a2c0e0","head":{"label":"DmitryDorofeev:master","ref":"master","sha":"275833be49b001bf282f1772786311b972a2c0e0","user":{"login":"DmitryDorofeev","id":6406737,"avatar_url":"https://avatars.githubusercontent.com/u/6406737?v=3","gravatar_id":"","url":"https://api.github.com/users/DmitryDorofeev","html_url":"https://github.com/DmitryDorofeev","followers_url":"https://api.github.com/users/DmitryDorofeev/followers","following_url":"https://api.github.com/users/DmitryDorofeev/following{/other_user}","gists_url":"https://api.github.com/users/DmitryDorofeev/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitryDorofeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitryDorofeev/subscriptions","organizations_url":"https://api.github.com/users/DmitryDorofeev/orgs","repos_url":"https://api.github.com/users/DmitryDorofeev/repos","events_url":"https://api.github.com/users/DmitryDorofeev/events{/privacy}","received_events_url":"https://api.github.com/users/DmitryDorofeev/received_events","type":"User","site_admin":false},"repo":{"id":31530289,"name":"home-assignment-1","full_name":"DmitryDorofeev/home-assignment-1","owner":{"login":"DmitryDorofeev","id":6406737,"avatar_url":"https://avatars.githubusercontent.com/u/6406737?v=3","gravatar_id":"","url":"https://api.github.com/users/DmitryDorofeev","html_url":"https://github.com/DmitryDorofeev","followers_url":"https://api.github.com/users/DmitryDorofeev/followers","following_url":"https://api.github.com/users/DmitryDorofeev/following{/other_user}","gists_url":"https://api.github.com/users/DmitryDorofeev/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitryDorofeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitryDorofeev/subscriptions","organizations_url":"https://api.github.com/users/DmitryDorofeev/orgs","repos_url":"https://api.github.com/users/DmitryDorofeev/repos","events_url":"https://api.github.com/users/DmitryDorofeev/events{/privacy}","received_events_url":"https://api.github.com/users/DmitryDorofeev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DmitryDorofeev/home-assignment-1","description":"","fork":true,"url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1","forks_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/forks","keys_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/teams","hooks_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/hooks","issue_events_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/issues/events{/number}","events_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/events","assignees_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/assignees{/user}","branches_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/branches{/branch}","tags_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/tags","blobs_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/statuses/{sha}","languages_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/languages","stargazers_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/stargazers","contributors_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/contributors","subscribers_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/subscribers","subscription_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/subscription","commits_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/contents/{+path}","compare_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/merges","archive_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/downloads","issues_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/issues{/number}","pulls_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/pulls{/number}","milestones_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/milestones{/number}","notifications_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/labels{/name}","releases_url":"https://api.github.com/repos/DmitryDorofeev/home-assignment-1/releases{/id}","created_at":"2015-03-02T08:27:50Z","updated_at":"2015-03-22T17:54:41Z","pushed_at":"2015-03-22T17:54:41Z","git_url":"git://github.com/DmitryDorofeev/home-assignment-1.git","ssh_url":"git@github.com:DmitryDorofeev/home-assignment-1.git","clone_url":"https://github.com/DmitryDorofeev/home-assignment-1.git","svn_url":"https://github.com/DmitryDorofeev/home-assignment-1","homepage":null,"size":154,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"bayandin:master","ref":"master","sha":"14964a800aa03f4027ac3d068ee92c2aac60529b","user":{"login":"bayandin","id":864213,"avatar_url":"https://avatars.githubusercontent.com/u/864213?v=3","gravatar_id":"","url":"https://api.github.com/users/bayandin","html_url":"https://github.com/bayandin","followers_url":"https://api.github.com/users/bayandin/followers","following_url":"https://api.github.com/users/bayandin/following{/other_user}","gists_url":"https://api.github.com/users/bayandin/gists{/gist_id}","starred_url":"https://api.github.com/users/bayandin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bayandin/subscriptions","organizations_url":"https://api.github.com/users/bayandin/orgs","repos_url":"https://api.github.com/users/bayandin/repos","events_url":"https://api.github.com/users/bayandin/events{/privacy}","received_events_url":"https://api.github.com/users/bayandin/received_events","type":"User","site_admin":false},"repo":{"id":31509224,"name":"home-assignment-1","full_name":"bayandin/home-assignment-1","owner":{"login":"bayandin","id":864213,"avatar_url":"https://avatars.githubusercontent.com/u/864213?v=3","gravatar_id":"","url":"https://api.github.com/users/bayandin","html_url":"https://github.com/bayandin","followers_url":"https://api.github.com/users/bayandin/followers","following_url":"https://api.github.com/users/bayandin/following{/other_user}","gists_url":"https://api.github.com/users/bayandin/gists{/gist_id}","starred_url":"https://api.github.com/users/bayandin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bayandin/subscriptions","organizations_url":"https://api.github.com/users/bayandin/orgs","repos_url":"https://api.github.com/users/bayandin/repos","events_url":"https://api.github.com/users/bayandin/events{/privacy}","received_events_url":"https://api.github.com/users/bayandin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bayandin/home-assignment-1","description":"","fork":false,"url":"https://api.github.com/repos/bayandin/home-assignment-1","forks_url":"https://api.github.com/repos/bayandin/home-assignment-1/forks","keys_url":"https://api.github.com/repos/bayandin/home-assignment-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bayandin/home-assignment-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bayandin/home-assignment-1/teams","hooks_url":"https://api.github.com/repos/bayandin/home-assignment-1/hooks","issue_events_url":"https://api.github.com/repos/bayandin/home-assignment-1/issues/events{/number}","events_url":"https://api.github.com/repos/bayandin/home-assignment-1/events","assignees_url":"https://api.github.com/repos/bayandin/home-assignment-1/assignees{/user}","branches_url":"https://api.github.com/repos/bayandin/home-assignment-1/branches{/branch}","tags_url":"https://api.github.com/repos/bayandin/home-assignment-1/tags","blobs_url":"https://api.github.com/repos/bayandin/home-assignment-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bayandin/home-assignment-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bayandin/home-assignment-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/bayandin/home-assignment-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bayandin/home-assignment-1/statuses/{sha}","languages_url":"https://api.github.com/repos/bayandin/home-assignment-1/languages","stargazers_url":"https://api.github.com/repos/bayandin/home-assignment-1/stargazers","contributors_url":"https://api.github.com/repos/bayandin/home-assignment-1/contributors","subscribers_url":"https://api.github.com/repos/bayandin/home-assignment-1/subscribers","subscription_url":"https://api.github.com/repos/bayandin/home-assignment-1/subscription","commits_url":"https://api.github.com/repos/bayandin/home-assignment-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/bayandin/home-assignment-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/bayandin/home-assignment-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/bayandin/home-assignment-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/bayandin/home-assignment-1/contents/{+path}","compare_url":"https://api.github.com/repos/bayandin/home-assignment-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bayandin/home-assignment-1/merges","archive_url":"https://api.github.com/repos/bayandin/home-assignment-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bayandin/home-assignment-1/downloads","issues_url":"https://api.github.com/repos/bayandin/home-assignment-1/issues{/number}","pulls_url":"https://api.github.com/repos/bayandin/home-assignment-1/pulls{/number}","milestones_url":"https://api.github.com/repos/bayandin/home-assignment-1/milestones{/number}","notifications_url":"https://api.github.com/repos/bayandin/home-assignment-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bayandin/home-assignment-1/labels{/name}","releases_url":"https://api.github.com/repos/bayandin/home-assignment-1/releases{/id}","created_at":"2015-03-01T20:16:48Z","updated_at":"2015-03-20T10:09:45Z","pushed_at":"2015-03-22T18:54:21Z","git_url":"git://github.com/bayandin/home-assignment-1.git","ssh_url":"git@github.com:bayandin/home-assignment-1.git","clone_url":"https://github.com/bayandin/home-assignment-1.git","svn_url":"https://github.com/bayandin/home-assignment-1","homepage":"","size":813,"stargazers_count":1,"watchers_count":1,"language":"Lua","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":3,"forks":11,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7"},"html":{"href":"https://github.com/bayandin/home-assignment-1/pull/7"},"issue":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/issues/7"},"comments":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/bayandin/home-assignment-1/statuses/275833be49b001bf282f1772786311b972a2c0e0"}}}}