{"action":"created","comment":{"url":"https://api.github.com/repos/unt-libraries/codalib/pulls/comments/33467142","id":33467142,"diff_hunk":"@@ -0,0 +1,208 @@\n+import os\n+import pytest\n+\n+from mock import mock_open\n+\n+from codalib import bagatom\n+\n+\n+# Settings for the monkeypatched fixtures\n+TEST_NAME = 'baz'\n+TEST_PATH = os.path.join('/foo/bar', TEST_NAME)\n+FILE_COUNT = 3\n+PAYLOAD_SIZE = 1500\n+BAGGING_DATE = '2015-01-01'\n+BAGIT_CONTENTS = 'BagIt-Version: 0.96\\nTag-File-Character-Encoding: UTF-8'\n+\n+\n+@pytest.fixture\n+def bagxml(monkeypatch):\n+    \"\"\"\n+    Test fixture that patches the following functions.\n+        open()\n+        bagatom.getBagTags()\n+        bagatom.getOxum()\n+    \"\"\"\n+    m = mock_open(read_data=BAGIT_CONTENTS)\n+    monkeypatch.setattr('__builtin__.open', m)\n+\n+    monkeypatch.setattr('codalib.bagatom.getBagTags', lambda x: {})\n+\n+    monkeypatch.setattr(\n+        'codalib.bagatom.getOxum',\n+        lambda x: '{0}.{1}'.format(PAYLOAD_SIZE, FILE_COUNT))\n+\n+    return bagatom.bagToXML(TEST_PATH)\n+\n+\n+@pytest.fixture\n+def bagxml_with_tags(monkeypatch):\n+    \"\"\"\n+    Test fixture that patches the following functions.\n+        open()\n+        bagatom.getBagTags()\n+        bagatom.getOxum()\n+\n+    Returns getBagTags returns a predefined set of tags.\n+    \"\"\"\n+    m = mock_open(read_data=BAGIT_CONTENTS)\n+    monkeypatch.setattr('__builtin__.open', m)\n+\n+    bagtags = {\n+        'Source-Organization': \"Test Org\",\n+        'Bag-Size': '1GB'\n+    }\n+    monkeypatch.setattr('codalib.bagatom.getBagTags', lambda x: bagtags)\n+\n+    monkeypatch.setattr(\n+        'codalib.bagatom.getOxum',\n+        lambda x: '{0}.{1}'.format(PAYLOAD_SIZE, FILE_COUNT))\n+\n+    return bagatom.bagToXML(TEST_PATH)\n+\n+\n+@pytest.fixture\n+def bagxml_with_bagging_date(monkeypatch):\n+    \"\"\"\n+    Test fixture that patches the following functions.","path":"tests/bagatom/test_bagToXML.py","position":67,"original_position":67,"commit_id":"806eaab59a6ec888e7ca2db07eb54e90addd52f2","original_commit_id":"806eaab59a6ec888e7ca2db07eb54e90addd52f2","user":{"login":"somexpert","id":5580991,"avatar_url":"https://avatars.githubusercontent.com/u/5580991?v=3","gravatar_id":"","url":"https://api.github.com/users/somexpert","html_url":"https://github.com/somexpert","followers_url":"https://api.github.com/users/somexpert/followers","following_url":"https://api.github.com/users/somexpert/following{/other_user}","gists_url":"https://api.github.com/users/somexpert/gists{/gist_id}","starred_url":"https://api.github.com/users/somexpert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somexpert/subscriptions","organizations_url":"https://api.github.com/users/somexpert/orgs","repos_url":"https://api.github.com/users/somexpert/repos","events_url":"https://api.github.com/users/somexpert/events{/privacy}","received_events_url":"https://api.github.com/users/somexpert/received_events","type":"User","site_admin":false},"body":"In this and the previous test docstrings, I could be wrong, but shouldn't the period on this line actually be a colon?","created_at":"2015-06-29T14:10:44Z","updated_at":"2015-06-29T14:10:44Z","html_url":"https://github.com/unt-libraries/codalib/pull/2#discussion_r33467142","pull_request_url":"https://api.github.com/repos/unt-libraries/codalib/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/unt-libraries/codalib/pulls/comments/33467142"},"html":{"href":"https://github.com/unt-libraries/codalib/pull/2#discussion_r33467142"},"pull_request":{"href":"https://api.github.com/repos/unt-libraries/codalib/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/unt-libraries/codalib/pulls/2","id":37826198,"html_url":"https://github.com/unt-libraries/codalib/pull/2","diff_url":"https://github.com/unt-libraries/codalib/pull/2.diff","patch_url":"https://github.com/unt-libraries/codalib/pull/2.patch","issue_url":"https://api.github.com/repos/unt-libraries/codalib/issues/2","number":2,"state":"open","locked":false,"title":"Tests","user":{"login":"damonkelley","id":4121849,"avatar_url":"https://avatars.githubusercontent.com/u/4121849?v=3","gravatar_id":"","url":"https://api.github.com/users/damonkelley","html_url":"https://github.com/damonkelley","followers_url":"https://api.github.com/users/damonkelley/followers","following_url":"https://api.github.com/users/damonkelley/following{/other_user}","gists_url":"https://api.github.com/users/damonkelley/gists{/gist_id}","starred_url":"https://api.github.com/users/damonkelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonkelley/subscriptions","organizations_url":"https://api.github.com/users/damonkelley/orgs","repos_url":"https://api.github.com/users/damonkelley/repos","events_url":"https://api.github.com/users/damonkelley/events{/privacy}","received_events_url":"https://api.github.com/users/damonkelley/received_events","type":"User","site_admin":false},"body":"This is still a work in progress. Opening it now to verify the Travis configuration.","created_at":"2015-06-16T18:29:46Z","updated_at":"2015-06-29T14:10:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0c3cec4162b28ab284734459b21d0180aa037e3","assignee":{"login":"damonkelley","id":4121849,"avatar_url":"https://avatars.githubusercontent.com/u/4121849?v=3","gravatar_id":"","url":"https://api.github.com/users/damonkelley","html_url":"https://github.com/damonkelley","followers_url":"https://api.github.com/users/damonkelley/followers","following_url":"https://api.github.com/users/damonkelley/following{/other_user}","gists_url":"https://api.github.com/users/damonkelley/gists{/gist_id}","starred_url":"https://api.github.com/users/damonkelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonkelley/subscriptions","organizations_url":"https://api.github.com/users/damonkelley/orgs","repos_url":"https://api.github.com/users/damonkelley/repos","events_url":"https://api.github.com/users/damonkelley/events{/privacy}","received_events_url":"https://api.github.com/users/damonkelley/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/unt-libraries/codalib/pulls/2/commits","review_comments_url":"https://api.github.com/repos/unt-libraries/codalib/pulls/2/comments","review_comment_url":"https://api.github.com/repos/unt-libraries/codalib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unt-libraries/codalib/issues/2/comments","statuses_url":"https://api.github.com/repos/unt-libraries/codalib/statuses/806eaab59a6ec888e7ca2db07eb54e90addd52f2","head":{"label":"unt-libraries:tests","ref":"tests","sha":"806eaab59a6ec888e7ca2db07eb54e90addd52f2","user":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"repo":{"id":37492128,"name":"codalib","full_name":"unt-libraries/codalib","owner":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unt-libraries/codalib","description":"","fork":false,"url":"https://api.github.com/repos/unt-libraries/codalib","forks_url":"https://api.github.com/repos/unt-libraries/codalib/forks","keys_url":"https://api.github.com/repos/unt-libraries/codalib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unt-libraries/codalib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unt-libraries/codalib/teams","hooks_url":"https://api.github.com/repos/unt-libraries/codalib/hooks","issue_events_url":"https://api.github.com/repos/unt-libraries/codalib/issues/events{/number}","events_url":"https://api.github.com/repos/unt-libraries/codalib/events","assignees_url":"https://api.github.com/repos/unt-libraries/codalib/assignees{/user}","branches_url":"https://api.github.com/repos/unt-libraries/codalib/branches{/branch}","tags_url":"https://api.github.com/repos/unt-libraries/codalib/tags","blobs_url":"https://api.github.com/repos/unt-libraries/codalib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unt-libraries/codalib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unt-libraries/codalib/git/refs{/sha}","trees_url":"https://api.github.com/repos/unt-libraries/codalib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unt-libraries/codalib/statuses/{sha}","languages_url":"https://api.github.com/repos/unt-libraries/codalib/languages","stargazers_url":"https://api.github.com/repos/unt-libraries/codalib/stargazers","contributors_url":"https://api.github.com/repos/unt-libraries/codalib/contributors","subscribers_url":"https://api.github.com/repos/unt-libraries/codalib/subscribers","subscription_url":"https://api.github.com/repos/unt-libraries/codalib/subscription","commits_url":"https://api.github.com/repos/unt-libraries/codalib/commits{/sha}","git_commits_url":"https://api.github.com/repos/unt-libraries/codalib/git/commits{/sha}","comments_url":"https://api.github.com/repos/unt-libraries/codalib/comments{/number}","issue_comment_url":"https://api.github.com/repos/unt-libraries/codalib/issues/comments{/number}","contents_url":"https://api.github.com/repos/unt-libraries/codalib/contents/{+path}","compare_url":"https://api.github.com/repos/unt-libraries/codalib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unt-libraries/codalib/merges","archive_url":"https://api.github.com/repos/unt-libraries/codalib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unt-libraries/codalib/downloads","issues_url":"https://api.github.com/repos/unt-libraries/codalib/issues{/number}","pulls_url":"https://api.github.com/repos/unt-libraries/codalib/pulls{/number}","milestones_url":"https://api.github.com/repos/unt-libraries/codalib/milestones{/number}","notifications_url":"https://api.github.com/repos/unt-libraries/codalib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unt-libraries/codalib/labels{/name}","releases_url":"https://api.github.com/repos/unt-libraries/codalib/releases{/id}","created_at":"2015-06-15T21:24:03Z","updated_at":"2015-06-15T21:25:12Z","pushed_at":"2015-06-26T20:28:04Z","git_url":"git://github.com/unt-libraries/codalib.git","ssh_url":"git@github.com:unt-libraries/codalib.git","clone_url":"https://github.com/unt-libraries/codalib.git","svn_url":"https://github.com/unt-libraries/codalib","homepage":null,"size":212,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"unt-libraries:master","ref":"master","sha":"78f2bf6120a080614cd6e1c0103c4b49b58a2a2a","user":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"repo":{"id":37492128,"name":"codalib","full_name":"unt-libraries/codalib","owner":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unt-libraries/codalib","description":"","fork":false,"url":"https://api.github.com/repos/unt-libraries/codalib","forks_url":"https://api.github.com/repos/unt-libraries/codalib/forks","keys_url":"https://api.github.com/repos/unt-libraries/codalib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unt-libraries/codalib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unt-libraries/codalib/teams","hooks_url":"https://api.github.com/repos/unt-libraries/codalib/hooks","issue_events_url":"https://api.github.com/repos/unt-libraries/codalib/issues/events{/number}","events_url":"https://api.github.com/repos/unt-libraries/codalib/events","assignees_url":"https://api.github.com/repos/unt-libraries/codalib/assignees{/user}","branches_url":"https://api.github.com/repos/unt-libraries/codalib/branches{/branch}","tags_url":"https://api.github.com/repos/unt-libraries/codalib/tags","blobs_url":"https://api.github.com/repos/unt-libraries/codalib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unt-libraries/codalib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unt-libraries/codalib/git/refs{/sha}","trees_url":"https://api.github.com/repos/unt-libraries/codalib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unt-libraries/codalib/statuses/{sha}","languages_url":"https://api.github.com/repos/unt-libraries/codalib/languages","stargazers_url":"https://api.github.com/repos/unt-libraries/codalib/stargazers","contributors_url":"https://api.github.com/repos/unt-libraries/codalib/contributors","subscribers_url":"https://api.github.com/repos/unt-libraries/codalib/subscribers","subscription_url":"https://api.github.com/repos/unt-libraries/codalib/subscription","commits_url":"https://api.github.com/repos/unt-libraries/codalib/commits{/sha}","git_commits_url":"https://api.github.com/repos/unt-libraries/codalib/git/commits{/sha}","comments_url":"https://api.github.com/repos/unt-libraries/codalib/comments{/number}","issue_comment_url":"https://api.github.com/repos/unt-libraries/codalib/issues/comments{/number}","contents_url":"https://api.github.com/repos/unt-libraries/codalib/contents/{+path}","compare_url":"https://api.github.com/repos/unt-libraries/codalib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unt-libraries/codalib/merges","archive_url":"https://api.github.com/repos/unt-libraries/codalib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unt-libraries/codalib/downloads","issues_url":"https://api.github.com/repos/unt-libraries/codalib/issues{/number}","pulls_url":"https://api.github.com/repos/unt-libraries/codalib/pulls{/number}","milestones_url":"https://api.github.com/repos/unt-libraries/codalib/milestones{/number}","notifications_url":"https://api.github.com/repos/unt-libraries/codalib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unt-libraries/codalib/labels{/name}","releases_url":"https://api.github.com/repos/unt-libraries/codalib/releases{/id}","created_at":"2015-06-15T21:24:03Z","updated_at":"2015-06-15T21:25:12Z","pushed_at":"2015-06-26T20:28:04Z","git_url":"git://github.com/unt-libraries/codalib.git","ssh_url":"git@github.com:unt-libraries/codalib.git","clone_url":"https://github.com/unt-libraries/codalib.git","svn_url":"https://github.com/unt-libraries/codalib","homepage":null,"size":212,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unt-libraries/codalib/pulls/2"},"html":{"href":"https://github.com/unt-libraries/codalib/pull/2"},"issue":{"href":"https://api.github.com/repos/unt-libraries/codalib/issues/2"},"comments":{"href":"https://api.github.com/repos/unt-libraries/codalib/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/unt-libraries/codalib/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/unt-libraries/codalib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unt-libraries/codalib/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/unt-libraries/codalib/statuses/806eaab59a6ec888e7ca2db07eb54e90addd52f2"}}}}