{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/comments/64919955","id":64919955,"diff_hunk":"@@ -1001,3 +1002,62 @@ def test_remove_user_from_other_organizations_team(self):\n                 'seedorganization-teams-users-detail',\n                 args=[org2.pk, team.pk, user.pk]))\n         self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)\n+\n+\n+class TokenTests(AuthAPITestCase):\n+    def test_create_token(self):\n+        '''Sending a valid email and password should create a token for that\n+        user.'''\n+        data = {\n+            'email': 'test@example.org',\n+            'password': 'testpass',\n+        }\n+        user = User.objects.create_user(\n+            username=data['email'], email=data['email'],\n+            password=data['password'])\n+\n+        response = self.client.post(reverse('create-token'), data=data)\n+        self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n+\n+        [token] = Token.objects.filter(user=user)\n+        self.assertEqual(token.key, response.data['token'])\n+\n+    def test_create_token_invalid_user(self):\n+        '''An invalid email, or incorrect password should return an\n+        unauthorized response.'''\n+        response = self.client.post(reverse('create-token'), data={\n+            'email': 'foo@bar.com', 'password': 'foo'})\n+        self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)","path":"authapi/tests/test_api.py","position":37,"original_position":37,"commit_id":"e250685ea1247760d610f7fdacee3c142355674b","original_commit_id":"e250685ea1247760d610f7fdacee3c142355674b","user":{"login":"justinvdm","id":1731223,"avatar_url":"https://avatars.githubusercontent.com/u/1731223?v=3","gravatar_id":"","url":"https://api.github.com/users/justinvdm","html_url":"https://github.com/justinvdm","followers_url":"https://api.github.com/users/justinvdm/followers","following_url":"https://api.github.com/users/justinvdm/following{/other_user}","gists_url":"https://api.github.com/users/justinvdm/gists{/gist_id}","starred_url":"https://api.github.com/users/justinvdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinvdm/subscriptions","organizations_url":"https://api.github.com/users/justinvdm/orgs","repos_url":"https://api.github.com/users/justinvdm/repos","events_url":"https://api.github.com/users/justinvdm/events{/privacy}","received_events_url":"https://api.github.com/users/justinvdm/received_events","type":"User","site_admin":false},"body":"Do we need to add a test for the valid email but invalid password case?","created_at":"2016-05-27T15:11:48Z","updated_at":"2016-05-27T15:11:48Z","html_url":"https://github.com/praekelt/seed-auth-api/pull/18#discussion_r64919955","pull_request_url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/comments/64919955"},"html":{"href":"https://github.com/praekelt/seed-auth-api/pull/18#discussion_r64919955"},"pull_request":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18","id":71726146,"html_url":"https://github.com/praekelt/seed-auth-api/pull/18","diff_url":"https://github.com/praekelt/seed-auth-api/pull/18.diff","patch_url":"https://github.com/praekelt/seed-auth-api/pull/18.patch","issue_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues/18","number":18,"state":"open","locked":false,"title":"Add token creation","user":{"login":"rudigiesler","id":8234653,"avatar_url":"https://avatars.githubusercontent.com/u/8234653?v=3","gravatar_id":"","url":"https://api.github.com/users/rudigiesler","html_url":"https://github.com/rudigiesler","followers_url":"https://api.github.com/users/rudigiesler/followers","following_url":"https://api.github.com/users/rudigiesler/following{/other_user}","gists_url":"https://api.github.com/users/rudigiesler/gists{/gist_id}","starred_url":"https://api.github.com/users/rudigiesler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudigiesler/subscriptions","organizations_url":"https://api.github.com/users/rudigiesler/orgs","repos_url":"https://api.github.com/users/rudigiesler/repos","events_url":"https://api.github.com/users/rudigiesler/events{/privacy}","received_events_url":"https://api.github.com/users/rudigiesler/received_events","type":"User","site_admin":false},"body":"Add the ability to create a token, by giving the email and password for the user.","created_at":"2016-05-27T14:56:56Z","updated_at":"2016-05-27T15:11:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2bc087f9d3e196e0c62dbca3b5459f972d92910","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18/commits","review_comments_url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18/comments","review_comment_url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues/18/comments","statuses_url":"https://api.github.com/repos/praekelt/seed-auth-api/statuses/e250685ea1247760d610f7fdacee3c142355674b","head":{"label":"praekelt:feature/issue-18-add-token-creation","ref":"feature/issue-18-add-token-creation","sha":"e250685ea1247760d610f7fdacee3c142355674b","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":58546064,"name":"seed-auth-api","full_name":"praekelt/seed-auth-api","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/seed-auth-api","description":"Authentication, authorization, and user store for seed applications.","fork":false,"url":"https://api.github.com/repos/praekelt/seed-auth-api","forks_url":"https://api.github.com/repos/praekelt/seed-auth-api/forks","keys_url":"https://api.github.com/repos/praekelt/seed-auth-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/seed-auth-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/seed-auth-api/teams","hooks_url":"https://api.github.com/repos/praekelt/seed-auth-api/hooks","issue_events_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/seed-auth-api/events","assignees_url":"https://api.github.com/repos/praekelt/seed-auth-api/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/seed-auth-api/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/seed-auth-api/tags","blobs_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/seed-auth-api/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/seed-auth-api/languages","stargazers_url":"https://api.github.com/repos/praekelt/seed-auth-api/stargazers","contributors_url":"https://api.github.com/repos/praekelt/seed-auth-api/contributors","subscribers_url":"https://api.github.com/repos/praekelt/seed-auth-api/subscribers","subscription_url":"https://api.github.com/repos/praekelt/seed-auth-api/subscription","commits_url":"https://api.github.com/repos/praekelt/seed-auth-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/seed-auth-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/seed-auth-api/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/seed-auth-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/seed-auth-api/merges","archive_url":"https://api.github.com/repos/praekelt/seed-auth-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/seed-auth-api/downloads","issues_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/seed-auth-api/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/seed-auth-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/seed-auth-api/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/seed-auth-api/releases{/id}","deployments_url":"https://api.github.com/repos/praekelt/seed-auth-api/deployments","created_at":"2016-05-11T13:12:50Z","updated_at":"2016-05-17T13:40:33Z","pushed_at":"2016-05-27T14:56:56Z","git_url":"git://github.com/praekelt/seed-auth-api.git","ssh_url":"git@github.com:praekelt/seed-auth-api.git","clone_url":"https://github.com/praekelt/seed-auth-api.git","svn_url":"https://github.com/praekelt/seed-auth-api","homepage":null,"size":119,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"d93e3b04b28459cf33828e76a63326099b4dbb91","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":58546064,"name":"seed-auth-api","full_name":"praekelt/seed-auth-api","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/seed-auth-api","description":"Authentication, authorization, and user store for seed applications.","fork":false,"url":"https://api.github.com/repos/praekelt/seed-auth-api","forks_url":"https://api.github.com/repos/praekelt/seed-auth-api/forks","keys_url":"https://api.github.com/repos/praekelt/seed-auth-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/seed-auth-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/seed-auth-api/teams","hooks_url":"https://api.github.com/repos/praekelt/seed-auth-api/hooks","issue_events_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/seed-auth-api/events","assignees_url":"https://api.github.com/repos/praekelt/seed-auth-api/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/seed-auth-api/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/seed-auth-api/tags","blobs_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/seed-auth-api/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/seed-auth-api/languages","stargazers_url":"https://api.github.com/repos/praekelt/seed-auth-api/stargazers","contributors_url":"https://api.github.com/repos/praekelt/seed-auth-api/contributors","subscribers_url":"https://api.github.com/repos/praekelt/seed-auth-api/subscribers","subscription_url":"https://api.github.com/repos/praekelt/seed-auth-api/subscription","commits_url":"https://api.github.com/repos/praekelt/seed-auth-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/seed-auth-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/seed-auth-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/seed-auth-api/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/seed-auth-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/seed-auth-api/merges","archive_url":"https://api.github.com/repos/praekelt/seed-auth-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/seed-auth-api/downloads","issues_url":"https://api.github.com/repos/praekelt/seed-auth-api/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/seed-auth-api/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/seed-auth-api/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/seed-auth-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/seed-auth-api/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/seed-auth-api/releases{/id}","deployments_url":"https://api.github.com/repos/praekelt/seed-auth-api/deployments","created_at":"2016-05-11T13:12:50Z","updated_at":"2016-05-17T13:40:33Z","pushed_at":"2016-05-27T14:56:56Z","git_url":"git://github.com/praekelt/seed-auth-api.git","ssh_url":"git@github.com:praekelt/seed-auth-api.git","clone_url":"https://github.com/praekelt/seed-auth-api.git","svn_url":"https://github.com/praekelt/seed-auth-api","homepage":null,"size":119,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18"},"html":{"href":"https://github.com/praekelt/seed-auth-api/pull/18"},"issue":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/issues/18"},"comments":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/seed-auth-api/statuses/e250685ea1247760d610f7fdacee3c142355674b"}}}}
{"actor":{"display_login":"justinvdm"}}