{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/73533789","id":73533789,"diff_hunk":"@@ -392,12 +413,49 @@ def test_attach_file(self):\n \n     def test_attach_text_as_bytes(self):\n         msg = EmailMessage('subject', 'body', 'from@example.com', ['to@example.com'])\n-        file_path = os.path.join(os.path.dirname(upath(__file__)), 'attachments', 'file.txt')\n-        with open(file_path, mode='rb') as fh:\n-            msg.attach('file.txt', fh.read())\n+        msg.attach('file.txt', b'file content')\n+\n+        # Check that the message would be sent at all.\n         sent_num = msg.send()\n         self.assertEqual(sent_num, 1)\n \n+        filename, content, mimetype = self.get_decoded_attachments(msg)[0]\n+\n+        self.assertEqual(filename, 'file.txt')\n+        self.assertEqual(content, b'file content')\n+        self.assertEqual(mimetype, 'text/plain')\n+\n+    def test_attach_utf8_text_as_bytes(self):\n+        \"\"\"\n+        Check whether an UTF-8 encoded non-ASCII character gets correctly\n+        transported and decoded.\n+        \"\"\"\n+        msg = EmailMessage('subject', 'body', 'from@example.com', ['to@example.com'])\n+        # UTF-8 encoded a umlaut.\n+        msg.attach('file.txt', b'\\xc3\\xa4')\n+\n+        filename, content, mimetype = self.get_decoded_attachments(msg)[0]\n+\n+        self.assertEqual(filename, 'file.txt')\n+        self.assertEqual(content, b'\\xc3\\xa4')\n+        self.assertEqual(mimetype, 'text/plain')\n+\n+    def test_attach_non_utf8_text_as_bytes(self):\n+        \"\"\"\n+        Check whether an UTF-8 encoded non-ASCII character gets correctly","path":"tests/mail/tests.py","position":null,"original_position":64,"commit_id":"4b20a5629804853d2a434eba24648ac9c78e52ec","original_commit_id":"6b76116737be53fbd8fbb11be487d27a923a3810","user":{"login":"Feuermurmel","id":50332,"avatar_url":"https://avatars.githubusercontent.com/u/50332?v=3","gravatar_id":"","url":"https://api.github.com/users/Feuermurmel","html_url":"https://github.com/Feuermurmel","followers_url":"https://api.github.com/users/Feuermurmel/followers","following_url":"https://api.github.com/users/Feuermurmel/following{/other_user}","gists_url":"https://api.github.com/users/Feuermurmel/gists{/gist_id}","starred_url":"https://api.github.com/users/Feuermurmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Feuermurmel/subscriptions","organizations_url":"https://api.github.com/users/Feuermurmel/orgs","repos_url":"https://api.github.com/users/Feuermurmel/repos","events_url":"https://api.github.com/users/Feuermurmel/events{/privacy}","received_events_url":"https://api.github.com/users/Feuermurmel/received_events","type":"User","site_admin":false},"body":"I copy-pasted the docstring. The reverse was meant indeed.","created_at":"2016-08-04T14:35:26Z","updated_at":"2016-08-04T14:35:26Z","html_url":"https://github.com/django/django/pull/7014#discussion_r73533789","pull_request_url":"https://api.github.com/repos/django/django/pulls/7014","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/73533789"},"html":{"href":"https://github.com/django/django/pull/7014#discussion_r73533789"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/7014"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/7014","id":79931303,"html_url":"https://github.com/django/django/pull/7014","diff_url":"https://github.com/django/django/pull/7014.diff","patch_url":"https://github.com/django/django/pull/7014.patch","issue_url":"https://api.github.com/repos/django/django/issues/7014","number":7014,"state":"open","locked":false,"title":"Fixed #27007 -- Handled non-UTF-8 bytes objects for text/* attachments.","user":{"login":"Feuermurmel","id":50332,"avatar_url":"https://avatars.githubusercontent.com/u/50332?v=3","gravatar_id":"","url":"https://api.github.com/users/Feuermurmel","html_url":"https://github.com/Feuermurmel","followers_url":"https://api.github.com/users/Feuermurmel/followers","following_url":"https://api.github.com/users/Feuermurmel/following{/other_user}","gists_url":"https://api.github.com/users/Feuermurmel/gists{/gist_id}","starred_url":"https://api.github.com/users/Feuermurmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Feuermurmel/subscriptions","organizations_url":"https://api.github.com/users/Feuermurmel/orgs","repos_url":"https://api.github.com/users/Feuermurmel/repos","events_url":"https://api.github.com/users/Feuermurmel/events{/privacy}","received_events_url":"https://api.github.com/users/Feuermurmel/received_events","type":"User","site_admin":false},"body":"See https://code.djangoproject.com/ticket/27007","created_at":"2016-08-03T15:53:09Z","updated_at":"2016-08-04T14:35:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"139f945a2ce5c8ee60606e93307f89e0daa245b3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/7014/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/7014/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/7014/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/4b20a5629804853d2a434eba24648ac9c78e52ec","head":{"label":"Feuermurmel:attachment-tests","ref":"attachment-tests","sha":"4b20a5629804853d2a434eba24648ac9c78e52ec","user":{"login":"Feuermurmel","id":50332,"avatar_url":"https://avatars.githubusercontent.com/u/50332?v=3","gravatar_id":"","url":"https://api.github.com/users/Feuermurmel","html_url":"https://github.com/Feuermurmel","followers_url":"https://api.github.com/users/Feuermurmel/followers","following_url":"https://api.github.com/users/Feuermurmel/following{/other_user}","gists_url":"https://api.github.com/users/Feuermurmel/gists{/gist_id}","starred_url":"https://api.github.com/users/Feuermurmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Feuermurmel/subscriptions","organizations_url":"https://api.github.com/users/Feuermurmel/orgs","repos_url":"https://api.github.com/users/Feuermurmel/repos","events_url":"https://api.github.com/users/Feuermurmel/events{/privacy}","received_events_url":"https://api.github.com/users/Feuermurmel/received_events","type":"User","site_admin":false},"repo":{"id":64843675,"name":"django","full_name":"Feuermurmel/django","owner":{"login":"Feuermurmel","id":50332,"avatar_url":"https://avatars.githubusercontent.com/u/50332?v=3","gravatar_id":"","url":"https://api.github.com/users/Feuermurmel","html_url":"https://github.com/Feuermurmel","followers_url":"https://api.github.com/users/Feuermurmel/followers","following_url":"https://api.github.com/users/Feuermurmel/following{/other_user}","gists_url":"https://api.github.com/users/Feuermurmel/gists{/gist_id}","starred_url":"https://api.github.com/users/Feuermurmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Feuermurmel/subscriptions","organizations_url":"https://api.github.com/users/Feuermurmel/orgs","repos_url":"https://api.github.com/users/Feuermurmel/repos","events_url":"https://api.github.com/users/Feuermurmel/events{/privacy}","received_events_url":"https://api.github.com/users/Feuermurmel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Feuermurmel/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/Feuermurmel/django","forks_url":"https://api.github.com/repos/Feuermurmel/django/forks","keys_url":"https://api.github.com/repos/Feuermurmel/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Feuermurmel/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Feuermurmel/django/teams","hooks_url":"https://api.github.com/repos/Feuermurmel/django/hooks","issue_events_url":"https://api.github.com/repos/Feuermurmel/django/issues/events{/number}","events_url":"https://api.github.com/repos/Feuermurmel/django/events","assignees_url":"https://api.github.com/repos/Feuermurmel/django/assignees{/user}","branches_url":"https://api.github.com/repos/Feuermurmel/django/branches{/branch}","tags_url":"https://api.github.com/repos/Feuermurmel/django/tags","blobs_url":"https://api.github.com/repos/Feuermurmel/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Feuermurmel/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Feuermurmel/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/Feuermurmel/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Feuermurmel/django/statuses/{sha}","languages_url":"https://api.github.com/repos/Feuermurmel/django/languages","stargazers_url":"https://api.github.com/repos/Feuermurmel/django/stargazers","contributors_url":"https://api.github.com/repos/Feuermurmel/django/contributors","subscribers_url":"https://api.github.com/repos/Feuermurmel/django/subscribers","subscription_url":"https://api.github.com/repos/Feuermurmel/django/subscription","commits_url":"https://api.github.com/repos/Feuermurmel/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/Feuermurmel/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/Feuermurmel/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/Feuermurmel/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/Feuermurmel/django/contents/{+path}","compare_url":"https://api.github.com/repos/Feuermurmel/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Feuermurmel/django/merges","archive_url":"https://api.github.com/repos/Feuermurmel/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Feuermurmel/django/downloads","issues_url":"https://api.github.com/repos/Feuermurmel/django/issues{/number}","pulls_url":"https://api.github.com/repos/Feuermurmel/django/pulls{/number}","milestones_url":"https://api.github.com/repos/Feuermurmel/django/milestones{/number}","notifications_url":"https://api.github.com/repos/Feuermurmel/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Feuermurmel/django/labels{/name}","releases_url":"https://api.github.com/repos/Feuermurmel/django/releases{/id}","deployments_url":"https://api.github.com/repos/Feuermurmel/django/deployments","created_at":"2016-08-03T12:17:37Z","updated_at":"2016-08-03T12:17:57Z","pushed_at":"2016-08-04T14:34:42Z","git_url":"git://github.com/Feuermurmel/django.git","ssh_url":"git@github.com:Feuermurmel/django.git","clone_url":"https://github.com/Feuermurmel/django.git","svn_url":"https://github.com/Feuermurmel/django","homepage":"https://www.djangoproject.com/","size":133264,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"django:master","ref":"master","sha":"272eccf7ff0ced609e5a5e3bb6b4a40e773e0e66","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","deployments_url":"https://api.github.com/repos/django/django/deployments","created_at":"2012-04-28T02:47:18Z","updated_at":"2016-08-04T14:35:12Z","pushed_at":"2016-08-04T14:34:44Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":196113,"stargazers_count":20589,"watchers_count":20589,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8323,"mirror_url":null,"open_issues_count":110,"forks":8323,"open_issues":110,"watchers":20589,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/7014"},"html":{"href":"https://github.com/django/django/pull/7014"},"issue":{"href":"https://api.github.com/repos/django/django/issues/7014"},"comments":{"href":"https://api.github.com/repos/django/django/issues/7014/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/7014/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/7014/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/4b20a5629804853d2a434eba24648ac9c78e52ec"}}}}
{"actor":{"display_login":"Feuermurmel"}}