{"action":"created","comment":{"url":"https://api.github.com/repos/jaywink/socialhome/pulls/comments/171987547","pull_request_review_id":100943172,"id":171987547,"diff_hunk":"@@ -25,3 +25,41 @@ def test_image_upload(self):\n         self.assertIn(\"http://127.0.0.1:8000/media/uploads/\", url)\n         image_upload = ImageUpload.objects.filter(user=self.user).first()\n         self.assertEqual(image_upload.image.name, url.replace(\"http://127.0.0.1:8000/media/\", \"\"))\n+\n+\n+class TestObtainSocialhomeAuthToken(SocialhomeAPITestCase):\n+    @classmethod\n+    def setUpTestData(cls):\n+        super().setUpTestData()\n+        cls.user = UserFactory()\n+\n+    def test_user_missing(self):\n+        response = self.client.post(reverse(\"api-token-auth\"))\n+        self.assertEqual(response.status_code, 400)\n+        self.assertEqual(response.data[\"username\"], [\"This field is required.\"])\n+\n+    def test_password_missing(self):\n+        response = self.client.post(reverse(\"api-token-auth\"))\n+        self.assertEqual(response.status_code, 400)\n+        self.assertEqual(response.data[\"password\"], [\"This field is required.\"])\n+\n+    def test_unable_to_login(self):\n+        response = self.client.post(reverse(\"api-token-auth\"),\n+                                    {\"username\": self.user.username, \"password\": \"%sLol\" % self.user.password})\n+        self.assertEqual(response.status_code, 400)\n+        self.assertEqual(response.data, {'non_field_errors': ['Unable to log in with provided credentials.']})\n+\n+    def test_authentication(self):\n+        self.client.force_authenticate(self.user, token=\"0ab231f9f7ab63a6f78fd9746b9bdc9926a734fd\")","path":"socialhome/tests/test_viewsets.py","position":29,"original_position":29,"commit_id":"60abba34dc47d658bd2d4ee7b5be830232f43be0","original_commit_id":"60abba34dc47d658bd2d4ee7b5be830232f43be0","user":{"login":"jaywink","id":1174866,"avatar_url":"https://avatars0.githubusercontent.com/u/1174866?v=4","gravatar_id":"","url":"https://api.github.com/users/jaywink","html_url":"https://github.com/jaywink","followers_url":"https://api.github.com/users/jaywink/followers","following_url":"https://api.github.com/users/jaywink/following{/other_user}","gists_url":"https://api.github.com/users/jaywink/gists{/gist_id}","starred_url":"https://api.github.com/users/jaywink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaywink/subscriptions","organizations_url":"https://api.github.com/users/jaywink/orgs","repos_url":"https://api.github.com/users/jaywink/repos","events_url":"https://api.github.com/users/jaywink/events{/privacy}","received_events_url":"https://api.github.com/users/jaywink/received_events","type":"User","site_admin":false},"body":"You're testing login so you shouldn't be forcing authentication in the test - this line shouldn't be here imho.","created_at":"2018-03-02T23:18:22Z","updated_at":"2018-03-02T23:21:24Z","html_url":"https://github.com/jaywink/socialhome/pull/447#discussion_r171987547","pull_request_url":"https://api.github.com/repos/jaywink/socialhome/pulls/447","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/jaywink/socialhome/pulls/comments/171987547"},"html":{"href":"https://github.com/jaywink/socialhome/pull/447#discussion_r171987547"},"pull_request":{"href":"https://api.github.com/repos/jaywink/socialhome/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/jaywink/socialhome/pulls/447","id":171585474,"html_url":"https://github.com/jaywink/socialhome/pull/447","diff_url":"https://github.com/jaywink/socialhome/pull/447.diff","patch_url":"https://github.com/jaywink/socialhome/pull/447.patch","issue_url":"https://api.github.com/repos/jaywink/socialhome/issues/447","number":447,"state":"open","locked":false,"title":"[WIP] Add user profile at authentication","user":{"login":"christophehenry","id":22097904,"avatar_url":"https://avatars3.githubusercontent.com/u/22097904?v=4","gravatar_id":"","url":"https://api.github.com/users/christophehenry","html_url":"https://github.com/christophehenry","followers_url":"https://api.github.com/users/christophehenry/followers","following_url":"https://api.github.com/users/christophehenry/following{/other_user}","gists_url":"https://api.github.com/users/christophehenry/gists{/gist_id}","starred_url":"https://api.github.com/users/christophehenry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christophehenry/subscriptions","organizations_url":"https://api.github.com/users/christophehenry/orgs","repos_url":"https://api.github.com/users/christophehenry/repos","events_url":"https://api.github.com/users/christophehenry/events{/privacy}","received_events_url":"https://api.github.com/users/christophehenry/received_events","type":"User","site_admin":false},"body":"`/api-token-auth/` now returns limited profile infos in addition to token:\r\n\r\n```\r\n{\r\n  \"guid\": \"eba9d938-71a2-4570-96c2-99e6e6bb232f\",\r\n  \"handle\": \"karl_marx@127.0.0.1:8000\",\r\n  \"home_url\": \"http:\\/\\/127.0.0.1:8000\\/p\\/eba9d938-71a2-4570-96c2-99e6e6bb232f\\/\",\r\n  \"id\": 2,\r\n  \"image_url_small\": \"http:\\/\\/127.0.0.1:8000\\/static\\/images\\/pony50.png\",\r\n  \"is_local\": true,\r\n  \"name\": \"\",\r\n  \"url\": \"http:\\/\\/127.0.0.1:8000\\/p\\/eba9d938-71a2-4570-96c2-99e6e6bb232f\\/\",\r\n  \"token\": \"0ab231f9f7ab63a6f78fd9746b9bdc9926a734fd\"\r\n}\r\n```\r\n\r\n- [x] Tests\r\n- [ ] Update the docs to explain how to recover token\r\n\r\nRefs: #446 ","created_at":"2018-02-27T07:44:17Z","updated_at":"2018-03-02T23:21:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8a02cb5677ae9c516c0a2f0b62cba5e4b746e19","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":358812832,"url":"https://api.github.com/repos/jaywink/socialhome/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/jaywink/socialhome/pulls/447/commits","review_comments_url":"https://api.github.com/repos/jaywink/socialhome/pulls/447/comments","review_comment_url":"https://api.github.com/repos/jaywink/socialhome/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jaywink/socialhome/issues/447/comments","statuses_url":"https://api.github.com/repos/jaywink/socialhome/statuses/60abba34dc47d658bd2d4ee7b5be830232f43be0","head":{"label":"christophehenry:add-user-profile-at-authent","ref":"add-user-profile-at-authent","sha":"60abba34dc47d658bd2d4ee7b5be830232f43be0","user":{"login":"christophehenry","id":22097904,"avatar_url":"https://avatars3.githubusercontent.com/u/22097904?v=4","gravatar_id":"","url":"https://api.github.com/users/christophehenry","html_url":"https://github.com/christophehenry","followers_url":"https://api.github.com/users/christophehenry/followers","following_url":"https://api.github.com/users/christophehenry/following{/other_user}","gists_url":"https://api.github.com/users/christophehenry/gists{/gist_id}","starred_url":"https://api.github.com/users/christophehenry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christophehenry/subscriptions","organizations_url":"https://api.github.com/users/christophehenry/orgs","repos_url":"https://api.github.com/users/christophehenry/repos","events_url":"https://api.github.com/users/christophehenry/events{/privacy}","received_events_url":"https://api.github.com/users/christophehenry/received_events","type":"User","site_admin":false},"repo":{"id":67941772,"name":"socialhome","full_name":"christophehenry/socialhome","owner":{"login":"christophehenry","id":22097904,"avatar_url":"https://avatars3.githubusercontent.com/u/22097904?v=4","gravatar_id":"","url":"https://api.github.com/users/christophehenry","html_url":"https://github.com/christophehenry","followers_url":"https://api.github.com/users/christophehenry/followers","following_url":"https://api.github.com/users/christophehenry/following{/other_user}","gists_url":"https://api.github.com/users/christophehenry/gists{/gist_id}","starred_url":"https://api.github.com/users/christophehenry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christophehenry/subscriptions","organizations_url":"https://api.github.com/users/christophehenry/orgs","repos_url":"https://api.github.com/users/christophehenry/repos","events_url":"https://api.github.com/users/christophehenry/events{/privacy}","received_events_url":"https://api.github.com/users/christophehenry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christophehenry/socialhome","description":"A federated social home.","fork":true,"url":"https://api.github.com/repos/christophehenry/socialhome","forks_url":"https://api.github.com/repos/christophehenry/socialhome/forks","keys_url":"https://api.github.com/repos/christophehenry/socialhome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christophehenry/socialhome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christophehenry/socialhome/teams","hooks_url":"https://api.github.com/repos/christophehenry/socialhome/hooks","issue_events_url":"https://api.github.com/repos/christophehenry/socialhome/issues/events{/number}","events_url":"https://api.github.com/repos/christophehenry/socialhome/events","assignees_url":"https://api.github.com/repos/christophehenry/socialhome/assignees{/user}","branches_url":"https://api.github.com/repos/christophehenry/socialhome/branches{/branch}","tags_url":"https://api.github.com/repos/christophehenry/socialhome/tags","blobs_url":"https://api.github.com/repos/christophehenry/socialhome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christophehenry/socialhome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christophehenry/socialhome/git/refs{/sha}","trees_url":"https://api.github.com/repos/christophehenry/socialhome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christophehenry/socialhome/statuses/{sha}","languages_url":"https://api.github.com/repos/christophehenry/socialhome/languages","stargazers_url":"https://api.github.com/repos/christophehenry/socialhome/stargazers","contributors_url":"https://api.github.com/repos/christophehenry/socialhome/contributors","subscribers_url":"https://api.github.com/repos/christophehenry/socialhome/subscribers","subscription_url":"https://api.github.com/repos/christophehenry/socialhome/subscription","commits_url":"https://api.github.com/repos/christophehenry/socialhome/commits{/sha}","git_commits_url":"https://api.github.com/repos/christophehenry/socialhome/git/commits{/sha}","comments_url":"https://api.github.com/repos/christophehenry/socialhome/comments{/number}","issue_comment_url":"https://api.github.com/repos/christophehenry/socialhome/issues/comments{/number}","contents_url":"https://api.github.com/repos/christophehenry/socialhome/contents/{+path}","compare_url":"https://api.github.com/repos/christophehenry/socialhome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christophehenry/socialhome/merges","archive_url":"https://api.github.com/repos/christophehenry/socialhome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christophehenry/socialhome/downloads","issues_url":"https://api.github.com/repos/christophehenry/socialhome/issues{/number}","pulls_url":"https://api.github.com/repos/christophehenry/socialhome/pulls{/number}","milestones_url":"https://api.github.com/repos/christophehenry/socialhome/milestones{/number}","notifications_url":"https://api.github.com/repos/christophehenry/socialhome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christophehenry/socialhome/labels{/name}","releases_url":"https://api.github.com/repos/christophehenry/socialhome/releases{/id}","deployments_url":"https://api.github.com/repos/christophehenry/socialhome/deployments","created_at":"2016-09-11T16:45:27Z","updated_at":"2017-12-14T20:52:44Z","pushed_at":"2018-02-28T22:00:42Z","git_url":"git://github.com/christophehenry/socialhome.git","ssh_url":"git@github.com:christophehenry/socialhome.git","clone_url":"https://github.com/christophehenry/socialhome.git","svn_url":"https://github.com/christophehenry/socialhome","homepage":null,"size":5071,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jaywink:master","ref":"master","sha":"f872152d5521ebc3ecaf4f4a06c10e8d64f539ce","user":{"login":"jaywink","id":1174866,"avatar_url":"https://avatars0.githubusercontent.com/u/1174866?v=4","gravatar_id":"","url":"https://api.github.com/users/jaywink","html_url":"https://github.com/jaywink","followers_url":"https://api.github.com/users/jaywink/followers","following_url":"https://api.github.com/users/jaywink/following{/other_user}","gists_url":"https://api.github.com/users/jaywink/gists{/gist_id}","starred_url":"https://api.github.com/users/jaywink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaywink/subscriptions","organizations_url":"https://api.github.com/users/jaywink/orgs","repos_url":"https://api.github.com/users/jaywink/repos","events_url":"https://api.github.com/users/jaywink/events{/privacy}","received_events_url":"https://api.github.com/users/jaywink/received_events","type":"User","site_admin":false},"repo":{"id":55836470,"name":"socialhome","full_name":"jaywink/socialhome","owner":{"login":"jaywink","id":1174866,"avatar_url":"https://avatars0.githubusercontent.com/u/1174866?v=4","gravatar_id":"","url":"https://api.github.com/users/jaywink","html_url":"https://github.com/jaywink","followers_url":"https://api.github.com/users/jaywink/followers","following_url":"https://api.github.com/users/jaywink/following{/other_user}","gists_url":"https://api.github.com/users/jaywink/gists{/gist_id}","starred_url":"https://api.github.com/users/jaywink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaywink/subscriptions","organizations_url":"https://api.github.com/users/jaywink/orgs","repos_url":"https://api.github.com/users/jaywink/repos","events_url":"https://api.github.com/users/jaywink/events{/privacy}","received_events_url":"https://api.github.com/users/jaywink/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jaywink/socialhome","description":"A federated social home.","fork":false,"url":"https://api.github.com/repos/jaywink/socialhome","forks_url":"https://api.github.com/repos/jaywink/socialhome/forks","keys_url":"https://api.github.com/repos/jaywink/socialhome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jaywink/socialhome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jaywink/socialhome/teams","hooks_url":"https://api.github.com/repos/jaywink/socialhome/hooks","issue_events_url":"https://api.github.com/repos/jaywink/socialhome/issues/events{/number}","events_url":"https://api.github.com/repos/jaywink/socialhome/events","assignees_url":"https://api.github.com/repos/jaywink/socialhome/assignees{/user}","branches_url":"https://api.github.com/repos/jaywink/socialhome/branches{/branch}","tags_url":"https://api.github.com/repos/jaywink/socialhome/tags","blobs_url":"https://api.github.com/repos/jaywink/socialhome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jaywink/socialhome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jaywink/socialhome/git/refs{/sha}","trees_url":"https://api.github.com/repos/jaywink/socialhome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jaywink/socialhome/statuses/{sha}","languages_url":"https://api.github.com/repos/jaywink/socialhome/languages","stargazers_url":"https://api.github.com/repos/jaywink/socialhome/stargazers","contributors_url":"https://api.github.com/repos/jaywink/socialhome/contributors","subscribers_url":"https://api.github.com/repos/jaywink/socialhome/subscribers","subscription_url":"https://api.github.com/repos/jaywink/socialhome/subscription","commits_url":"https://api.github.com/repos/jaywink/socialhome/commits{/sha}","git_commits_url":"https://api.github.com/repos/jaywink/socialhome/git/commits{/sha}","comments_url":"https://api.github.com/repos/jaywink/socialhome/comments{/number}","issue_comment_url":"https://api.github.com/repos/jaywink/socialhome/issues/comments{/number}","contents_url":"https://api.github.com/repos/jaywink/socialhome/contents/{+path}","compare_url":"https://api.github.com/repos/jaywink/socialhome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jaywink/socialhome/merges","archive_url":"https://api.github.com/repos/jaywink/socialhome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jaywink/socialhome/downloads","issues_url":"https://api.github.com/repos/jaywink/socialhome/issues{/number}","pulls_url":"https://api.github.com/repos/jaywink/socialhome/pulls{/number}","milestones_url":"https://api.github.com/repos/jaywink/socialhome/milestones{/number}","notifications_url":"https://api.github.com/repos/jaywink/socialhome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jaywink/socialhome/labels{/name}","releases_url":"https://api.github.com/repos/jaywink/socialhome/releases{/id}","deployments_url":"https://api.github.com/repos/jaywink/socialhome/deployments","created_at":"2016-04-09T09:35:46Z","updated_at":"2018-02-19T18:07:38Z","pushed_at":"2018-02-28T22:00:43Z","git_url":"git://github.com/jaywink/socialhome.git","ssh_url":"git@github.com:jaywink/socialhome.git","clone_url":"https://github.com/jaywink/socialhome.git","svn_url":"https://github.com/jaywink/socialhome","homepage":"https://socialhome.network","size":5032,"stargazers_count":74,"watchers_count":74,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"archived":false,"open_issues_count":115,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":21,"open_issues":115,"watchers":74,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jaywink/socialhome/pulls/447"},"html":{"href":"https://github.com/jaywink/socialhome/pull/447"},"issue":{"href":"https://api.github.com/repos/jaywink/socialhome/issues/447"},"comments":{"href":"https://api.github.com/repos/jaywink/socialhome/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/jaywink/socialhome/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/jaywink/socialhome/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jaywink/socialhome/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/jaywink/socialhome/statuses/60abba34dc47d658bd2d4ee7b5be830232f43be0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jaywink"}}