{"action":"created","comment":{"url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments/156643982","pull_request_review_id":83153072,"id":156643982,"diff_hunk":"@@ -0,0 +1,134 @@\n+import unittest\n+from activity.activity_PubmedArticleDeposit import activity_PubmedArticleDeposit\n+import shutil\n+from mock import patch\n+import tests.activity.settings_mock as settings_mock\n+from tests.activity.classes_mock import FakeLogger\n+from provider.article import article\n+from provider.simpleDB import SimpleDB\n+from provider import lax_provider\n+import tests.test_data as test_case_data\n+import os\n+from ddt import ddt, data\n+\n+# Add parent directory for imports, so activity classes can use elife-poa-xml-generation\n+PARENTDIR = os.path.dirname(os.path.dirname(\n+    os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n+os.sys.path.insert(0, PARENTDIR)\n+\n+@ddt\n+class TestPubmedArticleDeposit(unittest.TestCase):\n+\n+    def setUp(self):\n+        fake_logger = FakeLogger()\n+        self.activity = activity_PubmedArticleDeposit(settings_mock, fake_logger, None, None, None)\n+\n+\n+    def tearDown(self):\n+        self.activity.clean_tmp_dir()\n+\n+\n+    def input_dir(self):\n+        \"return the staging dir name for the activity\"\n+        return self.activity.elife_poa_lib.settings.STAGING_TO_HW_DIR\n+\n+\n+    def tmp_dir(self):\n+        \"return the tmp dir name for the activity\"\n+        return self.activity.elife_poa_lib.settings.TMP_DIR\n+\n+\n+    def fake_download_files_from_s3_outbox(self, document):\n+        source_doc = \"tests/test_data/pubmed/\" + document\n+        dest_doc = self.input_dir() + os.sep + document\n+        shutil.copy(source_doc, dest_doc)\n+\n+\n+    @patch.object(SimpleDB, 'elife_add_email_to_email_queue')\n+    @patch.object(activity_PubmedArticleDeposit, 'upload_pubmed_xml_to_s3')\n+    @patch.object(activity_PubmedArticleDeposit, 'clean_outbox')\n+    @patch.object(activity_PubmedArticleDeposit, 'ftp_files_to_endpoint')\n+    @patch.object(article, 'get_article_bucket_pub_date')\n+    @patch.object(lax_provider, 'was_ever_poa')\n+    @patch.object(lax_provider, 'published_considering_poa_status')\n+    @patch.object(lax_provider, 'article_highest_version')\n+    @patch.object(activity_PubmedArticleDeposit, 'get_outbox_s3_key_names')\n+    @patch.object(activity_PubmedArticleDeposit, 'download_files_from_s3_outbox')","path":"tests/activity/test_activity_pubmed_article_deposit.py","position":56,"original_position":56,"commit_id":"b1092ffe13fd4dd3db924f724bc7bf665f037d7f","original_commit_id":"b1092ffe13fd4dd3db924f724bc7bf665f037d7f","user":{"login":"giorgiosironi","id":160299,"avatar_url":"https://avatars3.githubusercontent.com/u/160299?v=4","gravatar_id":"","url":"https://api.github.com/users/giorgiosironi","html_url":"https://github.com/giorgiosironi","followers_url":"https://api.github.com/users/giorgiosironi/followers","following_url":"https://api.github.com/users/giorgiosironi/following{/other_user}","gists_url":"https://api.github.com/users/giorgiosironi/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiosironi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiosironi/subscriptions","organizations_url":"https://api.github.com/users/giorgiosironi/orgs","repos_url":"https://api.github.com/users/giorgiosironi/repos","events_url":"https://api.github.com/users/giorgiosironi/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiosironi/received_events","type":"User","site_admin":false},"body":"it's a lot of stubbing, but better than having no tests before refactoring :+1: ","created_at":"2017-12-13T12:24:49Z","updated_at":"2017-12-13T12:24:49Z","html_url":"https://github.com/elifesciences/elife-bot/pull/558#discussion_r156643982","pull_request_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments/156643982"},"html":{"href":"https://github.com/elifesciences/elife-bot/pull/558#discussion_r156643982"},"pull_request":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558"}}},"pull_request":{"url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558","id":157990258,"html_url":"https://github.com/elifesciences/elife-bot/pull/558","diff_url":"https://github.com/elifesciences/elife-bot/pull/558.diff","patch_url":"https://github.com/elifesciences/elife-bot/pull/558.patch","issue_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/558","number":558,"state":"open","locked":false,"title":"Tests for PubmedArticleDeposit activity, prior to refactoring it.","user":{"login":"gnott","id":1779115,"avatar_url":"https://avatars1.githubusercontent.com/u/1779115?v=4","gravatar_id":"","url":"https://api.github.com/users/gnott","html_url":"https://github.com/gnott","followers_url":"https://api.github.com/users/gnott/followers","following_url":"https://api.github.com/users/gnott/following{/other_user}","gists_url":"https://api.github.com/users/gnott/gists{/gist_id}","starred_url":"https://api.github.com/users/gnott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnott/subscriptions","organizations_url":"https://api.github.com/users/gnott/orgs","repos_url":"https://api.github.com/users/gnott/repos","events_url":"https://api.github.com/users/gnott/events{/privacy}","received_events_url":"https://api.github.com/users/gnott/received_events","type":"User","site_admin":false},"body":"If anyone wants to take a look, this is just a basic test so there are some tests before I set about introducing the the PubMed code library and refactoring the activity. The test should still be compatible with the code as it is now and can be merged before I start refactoring.\r\n\r\nI based this on the tests in https://github.com/elifesciences/elife-bot/blob/develop/tests/activity/test_activity_deposit_crossref.py which are fairly similar functionally.","created_at":"2017-12-13T02:38:15Z","updated_at":"2017-12-13T12:24:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1b15b947dc3a648495012db7b09a2a2074de283","assignee":null,"assignees":[],"requested_reviewers":[{"login":"seanwiseman","id":30619751,"avatar_url":"https://avatars2.githubusercontent.com/u/30619751?v=4","gravatar_id":"","url":"https://api.github.com/users/seanwiseman","html_url":"https://github.com/seanwiseman","followers_url":"https://api.github.com/users/seanwiseman/followers","following_url":"https://api.github.com/users/seanwiseman/following{/other_user}","gists_url":"https://api.github.com/users/seanwiseman/gists{/gist_id}","starred_url":"https://api.github.com/users/seanwiseman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanwiseman/subscriptions","organizations_url":"https://api.github.com/users/seanwiseman/orgs","repos_url":"https://api.github.com/users/seanwiseman/repos","events_url":"https://api.github.com/users/seanwiseman/events{/privacy}","received_events_url":"https://api.github.com/users/seanwiseman/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558/commits","review_comments_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558/comments","review_comment_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/558/comments","statuses_url":"https://api.github.com/repos/elifesciences/elife-bot/statuses/b1092ffe13fd4dd3db924f724bc7bf665f037d7f","head":{"label":"elifesciences:feature-pubmed","ref":"feature-pubmed","sha":"b1092ffe13fd4dd3db924f724bc7bf665f037d7f","user":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":7503542,"name":"elife-bot","full_name":"elifesciences/elife-bot","owner":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/elife-bot","description":"tools for creating an automatic publishing workflow. ","fork":false,"url":"https://api.github.com/repos/elifesciences/elife-bot","forks_url":"https://api.github.com/repos/elifesciences/elife-bot/forks","keys_url":"https://api.github.com/repos/elifesciences/elife-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/elife-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/elife-bot/teams","hooks_url":"https://api.github.com/repos/elifesciences/elife-bot/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/elife-bot/events","assignees_url":"https://api.github.com/repos/elifesciences/elife-bot/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/elife-bot/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/elife-bot/tags","blobs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/elife-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/elife-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/elife-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/elife-bot/languages","stargazers_url":"https://api.github.com/repos/elifesciences/elife-bot/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/elife-bot/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/elife-bot/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/elife-bot/subscription","commits_url":"https://api.github.com/repos/elifesciences/elife-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/elife-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/elife-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/elife-bot/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/elife-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/elife-bot/merges","archive_url":"https://api.github.com/repos/elifesciences/elife-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/elife-bot/downloads","issues_url":"https://api.github.com/repos/elifesciences/elife-bot/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/elife-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/elife-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/elife-bot/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/elife-bot/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/elife-bot/deployments","created_at":"2013-01-08T15:09:54Z","updated_at":"2017-11-21T23:50:19Z","pushed_at":"2017-12-13T10:37:28Z","git_url":"git://github.com/elifesciences/elife-bot.git","ssh_url":"git@github.com:elifesciences/elife-bot.git","clone_url":"https://github.com/elifesciences/elife-bot.git","svn_url":"https://github.com/elifesciences/elife-bot","homepage":null,"size":96167,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":28,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":8,"open_issues":28,"watchers":14,"default_branch":"develop"}},"base":{"label":"elifesciences:develop","ref":"develop","sha":"4c756891dd3ffbd2ed412df105df8c250cca61fd","user":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":7503542,"name":"elife-bot","full_name":"elifesciences/elife-bot","owner":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/elife-bot","description":"tools for creating an automatic publishing workflow. ","fork":false,"url":"https://api.github.com/repos/elifesciences/elife-bot","forks_url":"https://api.github.com/repos/elifesciences/elife-bot/forks","keys_url":"https://api.github.com/repos/elifesciences/elife-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/elife-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/elife-bot/teams","hooks_url":"https://api.github.com/repos/elifesciences/elife-bot/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/elife-bot/events","assignees_url":"https://api.github.com/repos/elifesciences/elife-bot/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/elife-bot/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/elife-bot/tags","blobs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/elife-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/elife-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/elife-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/elife-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/elife-bot/languages","stargazers_url":"https://api.github.com/repos/elifesciences/elife-bot/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/elife-bot/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/elife-bot/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/elife-bot/subscription","commits_url":"https://api.github.com/repos/elifesciences/elife-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/elife-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/elife-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/elife-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/elife-bot/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/elife-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/elife-bot/merges","archive_url":"https://api.github.com/repos/elifesciences/elife-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/elife-bot/downloads","issues_url":"https://api.github.com/repos/elifesciences/elife-bot/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/elife-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/elife-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/elife-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/elife-bot/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/elife-bot/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/elife-bot/deployments","created_at":"2013-01-08T15:09:54Z","updated_at":"2017-11-21T23:50:19Z","pushed_at":"2017-12-13T10:37:28Z","git_url":"git://github.com/elifesciences/elife-bot.git","ssh_url":"git@github.com:elifesciences/elife-bot.git","clone_url":"https://github.com/elifesciences/elife-bot.git","svn_url":"https://github.com/elifesciences/elife-bot","homepage":null,"size":96167,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":28,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":8,"open_issues":28,"watchers":14,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558"},"html":{"href":"https://github.com/elifesciences/elife-bot/pull/558"},"issue":{"href":"https://api.github.com/repos/elifesciences/elife-bot/issues/558"},"comments":{"href":"https://api.github.com/repos/elifesciences/elife-bot/issues/558/comments"},"review_comments":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558/comments"},"review_comment":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elifesciences/elife-bot/pulls/558/commits"},"statuses":{"href":"https://api.github.com/repos/elifesciences/elife-bot/statuses/b1092ffe13fd4dd3db924f724bc7bf665f037d7f"}},"author_association":"OWNER"}}
{"actor":{"display_login":"giorgiosironi"}}