{"action":"created","comment":{"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments/46841713","id":46841713,"diff_hunk":"@@ -0,0 +1,56 @@\n+#!/usr/bin/env python\n+\n+import hashlib\n+import hmac\n+import json\n+import time\n+import uuid\n+\n+import requests\n+from django.conf import settings\n+\n+try:\n+    settings.NO_REPLY_ADDRESS\n+except ImportError:\n+    # make sure the project root is in sys.path\n+    import os, sys\n+    sys.path.insert(0, os.path.normpath(\n+                           os.path.join(os.path.abspath(__file__), '..', '..', '..')))\n+\n+def generate_signature_dict():\n+    timestamp = str(time.time())\n+    token = str(uuid.uuid4())\n+    signature = hmac.new(\n+        key=settings.LISTSERV_API_KEY,\n+        msg='{}{}'.format(timestamp, token),\n+        digestmod=hashlib.sha256\n+    ).hexdigest()\n+    return {\n+        'timestamp': timestamp,\n+        'token': token,\n+        'signature': signature\n+    }\n+\n+# prep the post body\n+list_address = 'canvas-6760-2069@mg.dev.tlt.harvard.edu'\n+post_body = {\n+    'sender': 'integrationtest@example.edu',\n+    'recipient': list_address,\n+    'from': 'Integration Test <integrationtest@example.edu>',\n+    'subject': 'blah',\n+    'body-plain': 'blah blah',\n+    'attachment-count': 1,\n+    'To': list_address,\n+}\n+post_body.update(generate_signature_dict())\n+\n+# figure out which server to post to\n+env_name = settings.ENV_NAME\n+if env_name not in ('dev', 'qa', 'stage'):\n+    env_name = 'dev'\n+\n+# post it\n+url = 'https://lti-emailer.%s.tlt.harvard.edu/mailgun/handle_mailing_list_email_route/' % env_name\n+resp = requests.post(url, data=post_body)\n+if not resp.status_code == 400:","path":"mailgun/test_scripts/tlt-2108-handle-missing-attachments-integration-test.py","position":55,"original_position":55,"commit_id":"e81d94453f91cfef56fc30d713c94bbeaa55d9b0","original_commit_id":"e81d94453f91cfef56fc30d713c94bbeaa55d9b0","user":{"login":"rascalking","id":707505,"avatar_url":"https://avatars.githubusercontent.com/u/707505?v=3","gravatar_id":"","url":"https://api.github.com/users/rascalking","html_url":"https://github.com/rascalking","followers_url":"https://api.github.com/users/rascalking/followers","following_url":"https://api.github.com/users/rascalking/following{/other_user}","gists_url":"https://api.github.com/users/rascalking/gists{/gist_id}","starred_url":"https://api.github.com/users/rascalking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rascalking/subscriptions","organizations_url":"https://api.github.com/users/rascalking/orgs","repos_url":"https://api.github.com/users/rascalking/repos","events_url":"https://api.github.com/users/rascalking/events{/privacy}","received_events_url":"https://api.github.com/users/rascalking/received_events","type":"User","site_admin":false},"body":"Yup.  As to why I didn't write this as `if resp.status_code != 400:`, that's beyond me.","created_at":"2015-12-07T16:30:01Z","updated_at":"2015-12-07T16:30:01Z","html_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/155#discussion_r46841713","pull_request_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155","_links":{"self":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments/46841713"},"html":{"href":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/155#discussion_r46841713"},"pull_request":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155"}}},"pull_request":{"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155","id":52865869,"html_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/155","diff_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/155.diff","patch_url":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/155.patch","issue_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/155","number":155,"state":"open","locked":false,"title":"Sprint 37 TLT-2108 Add integration test script","user":{"login":"rascalking","id":707505,"avatar_url":"https://avatars.githubusercontent.com/u/707505?v=3","gravatar_id":"","url":"https://api.github.com/users/rascalking","html_url":"https://github.com/rascalking","followers_url":"https://api.github.com/users/rascalking/followers","following_url":"https://api.github.com/users/rascalking/following{/other_user}","gists_url":"https://api.github.com/users/rascalking/gists{/gist_id}","starred_url":"https://api.github.com/users/rascalking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rascalking/subscriptions","organizations_url":"https://api.github.com/users/rascalking/orgs","repos_url":"https://api.github.com/users/rascalking/repos","events_url":"https://api.github.com/users/rascalking/events{/privacy}","received_events_url":"https://api.github.com/users/rascalking/received_events","type":"User","site_admin":false},"body":"cut-pasted from the one for 2114, with the post body and response\r\nhandling tweaked.  next time we want one of these, i library it up good.\r\n\r\n* also rename integration test for 2114, fix typo in it","created_at":"2015-12-07T16:22:54Z","updated_at":"2015-12-07T16:30:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"985ec085f16a64c5d580778b1b7ad18e5c3faa82","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155/commits","review_comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155/comments","review_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/155/comments","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/e81d94453f91cfef56fc30d713c94bbeaa55d9b0","head":{"label":"Harvard-University-iCommons:task/rascalking/tlt-2108/add-integration-test-script","ref":"task/rascalking/tlt-2108/add-integration-test-script","sha":"e81d94453f91cfef56fc30d713c94bbeaa55d9b0","user":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"repo":{"id":33729277,"name":"lti_emailer","full_name":"Harvard-University-iCommons/lti_emailer","owner":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Harvard-University-iCommons/lti_emailer","description":"LTI tool that provides mailing-list capabilities for courses","fork":false,"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer","forks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/forks","keys_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/teams","hooks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/hooks","issue_events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/events{/number}","events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/events","assignees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/assignees{/user}","branches_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/branches{/branch}","tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/tags","blobs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/{sha}","languages_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/languages","stargazers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/stargazers","contributors_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contributors","subscribers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscribers","subscription_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscription","commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contents/{+path}","compare_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/merges","archive_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/downloads","issues_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues{/number}","pulls_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls{/number}","milestones_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/milestones{/number}","notifications_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/labels{/name}","releases_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/releases{/id}","created_at":"2015-04-10T13:16:08Z","updated_at":"2015-10-19T13:58:43Z","pushed_at":"2015-12-07T16:22:54Z","git_url":"git://github.com/Harvard-University-iCommons/lti_emailer.git","ssh_url":"git@github.com:Harvard-University-iCommons/lti_emailer.git","clone_url":"https://github.com/Harvard-University-iCommons/lti_emailer.git","svn_url":"https://github.com/Harvard-University-iCommons/lti_emailer","homepage":"","size":633,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"develop"}},"base":{"label":"Harvard-University-iCommons:develop","ref":"develop","sha":"750657d47a659ad0f064576d38c2bd0f78d5301f","user":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"repo":{"id":33729277,"name":"lti_emailer","full_name":"Harvard-University-iCommons/lti_emailer","owner":{"login":"Harvard-University-iCommons","id":1083915,"avatar_url":"https://avatars.githubusercontent.com/u/1083915?v=3","gravatar_id":"","url":"https://api.github.com/users/Harvard-University-iCommons","html_url":"https://github.com/Harvard-University-iCommons","followers_url":"https://api.github.com/users/Harvard-University-iCommons/followers","following_url":"https://api.github.com/users/Harvard-University-iCommons/following{/other_user}","gists_url":"https://api.github.com/users/Harvard-University-iCommons/gists{/gist_id}","starred_url":"https://api.github.com/users/Harvard-University-iCommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Harvard-University-iCommons/subscriptions","organizations_url":"https://api.github.com/users/Harvard-University-iCommons/orgs","repos_url":"https://api.github.com/users/Harvard-University-iCommons/repos","events_url":"https://api.github.com/users/Harvard-University-iCommons/events{/privacy}","received_events_url":"https://api.github.com/users/Harvard-University-iCommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Harvard-University-iCommons/lti_emailer","description":"LTI tool that provides mailing-list capabilities for courses","fork":false,"url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer","forks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/forks","keys_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/teams","hooks_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/hooks","issue_events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/events{/number}","events_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/events","assignees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/assignees{/user}","branches_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/branches{/branch}","tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/tags","blobs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/{sha}","languages_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/languages","stargazers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/stargazers","contributors_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contributors","subscribers_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscribers","subscription_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/subscription","commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/contents/{+path}","compare_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/merges","archive_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/downloads","issues_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues{/number}","pulls_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls{/number}","milestones_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/milestones{/number}","notifications_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/labels{/name}","releases_url":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/releases{/id}","created_at":"2015-04-10T13:16:08Z","updated_at":"2015-10-19T13:58:43Z","pushed_at":"2015-12-07T16:22:54Z","git_url":"git://github.com/Harvard-University-iCommons/lti_emailer.git","ssh_url":"git@github.com:Harvard-University-iCommons/lti_emailer.git","clone_url":"https://github.com/Harvard-University-iCommons/lti_emailer.git","svn_url":"https://github.com/Harvard-University-iCommons/lti_emailer","homepage":"","size":633,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155"},"html":{"href":"https://github.com/Harvard-University-iCommons/lti_emailer/pull/155"},"issue":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/155"},"comments":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/issues/155/comments"},"review_comments":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155/comments"},"review_comment":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/pulls/155/commits"},"statuses":{"href":"https://api.github.com/repos/Harvard-University-iCommons/lti_emailer/statuses/e81d94453f91cfef56fc30d713c94bbeaa55d9b0"}}}}