{"action":"created","comment":{"url":"https://api.github.com/repos/MTG/freesound/pulls/comments/168479045","pull_request_review_id":96851128,"id":168479045,"diff_hunk":"@@ -1205,9 +1205,35 @@ def test_change_username_form_admin(self):\n         self.assertEqual(OldUsername.objects.filter(user=userA).count(), 2)\n \n         # Try to rename for a third time to a valid username. Because we are in admin now, the USERNAME_CHANGE_MAX_TIMES\n-        # restriciton does not apply so rename should work correctly\n+        # restriction does not apply so rename should work correctly\n         post_data.update({'username': u'userANewNewNewName'})\n         resp = self.client.post(admin_change_url, data=post_data)\n         self.assertRedirects(resp, reverse('admin:auth_user_changelist'))  # Successful edit redirects to users list\n         self.assertEqual(OldUsername.objects.filter(username='userANewNewName', user=userA).count(), 1)\n         self.assertEqual(OldUsername.objects.filter(user=userA).count(), 3)\n+\n+\n+class UsernameValidatorTests(TestCase):\n+    \"\"\" Makes sure that username validation works as intended \"\"\"\n+    class TestForm(forms.Form):\n+        username = UsernameField()\n+\n+    def test_valid(self):\n+        \"\"\" Alphanumerics, _, - and + are ok\"\"\"\n+        form = self.TestForm(data={'username': 'normal_user.name+'})\n+        self.assertTrue(form.is_valid())\n+\n+    def test_email_like_invalid(self):\n+        \"\"\" We don't allow @ character \"\"\"\n+        form = self.TestForm(data={'username': 'email@username'})\n+        self.assertFalse(form.is_valid())\n+\n+    def test_short_invalid(self):\n+        \"\"\" Should be longer than 3 characters \"\"\"\n+        form = self.TestForm(data={'username': 'a'})\n+        self.assertFalse(form.is_valid())\n+\n+    def test_long_invalid(self):\n+        \"\"\" Should be shorter than 3 characters \"\"\"","path":"accounts/tests.py","position":65,"original_position":65,"commit_id":"af9cf01df539254e98fd0fa7b44f3e5d5c3b4756","original_commit_id":"af9cf01df539254e98fd0fa7b44f3e5d5c3b4756","user":{"login":"ffont","id":478615,"avatar_url":"https://avatars2.githubusercontent.com/u/478615?v=4","gravatar_id":"","url":"https://api.github.com/users/ffont","html_url":"https://github.com/ffont","followers_url":"https://api.github.com/users/ffont/followers","following_url":"https://api.github.com/users/ffont/following{/other_user}","gists_url":"https://api.github.com/users/ffont/gists{/gist_id}","starred_url":"https://api.github.com/users/ffont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ffont/subscriptions","organizations_url":"https://api.github.com/users/ffont/orgs","repos_url":"https://api.github.com/users/ffont/repos","events_url":"https://api.github.com/users/ffont/events{/privacy}","received_events_url":"https://api.github.com/users/ffont/received_events","type":"User","site_admin":false},"body":"Instead of 3 it should say 30 here right?","created_at":"2018-02-15T13:47:53Z","updated_at":"2018-02-15T13:47:53Z","html_url":"https://github.com/MTG/freesound/pull/1125#discussion_r168479045","pull_request_url":"https://api.github.com/repos/MTG/freesound/pulls/1125","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/MTG/freesound/pulls/comments/168479045"},"html":{"href":"https://github.com/MTG/freesound/pull/1125#discussion_r168479045"},"pull_request":{"href":"https://api.github.com/repos/MTG/freesound/pulls/1125"}}},"pull_request":{"url":"https://api.github.com/repos/MTG/freesound/pulls/1125","id":168256725,"html_url":"https://github.com/MTG/freesound/pull/1125","diff_url":"https://github.com/MTG/freesound/pull/1125.diff","patch_url":"https://github.com/MTG/freesound/pull/1125.patch","issue_url":"https://api.github.com/repos/MTG/freesound/issues/1125","number":1125,"state":"open","locked":false,"title":"Update username field (disallow @), add validation tests","user":{"login":"philtgun","id":1110902,"avatar_url":"https://avatars1.githubusercontent.com/u/1110902?v=4","gravatar_id":"","url":"https://api.github.com/users/philtgun","html_url":"https://github.com/philtgun","followers_url":"https://api.github.com/users/philtgun/followers","following_url":"https://api.github.com/users/philtgun/following{/other_user}","gists_url":"https://api.github.com/users/philtgun/gists{/gist_id}","starred_url":"https://api.github.com/users/philtgun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philtgun/subscriptions","organizations_url":"https://api.github.com/users/philtgun/orgs","repos_url":"https://api.github.com/users/philtgun/repos","events_url":"https://api.github.com/users/philtgun/events{/privacy}","received_events_url":"https://api.github.com/users/philtgun/received_events","type":"User","site_admin":false},"body":"- Replace `username_field` with a class, changed from `RegexField` to `CharField` with `Validator`\r\n- Remove `@` from validation regex (#1103)\r\n- Add some tests for validation\r\n- Updated `help_text` to match regex\r\n- Fixed some typos","created_at":"2018-02-09T14:43:55Z","updated_at":"2018-02-15T13:47:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"162714f83863f5e336070bb5eedc9df41b5dd884","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MTG/freesound/pulls/1125/commits","review_comments_url":"https://api.github.com/repos/MTG/freesound/pulls/1125/comments","review_comment_url":"https://api.github.com/repos/MTG/freesound/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MTG/freesound/issues/1125/comments","statuses_url":"https://api.github.com/repos/MTG/freesound/statuses/af9cf01df539254e98fd0fa7b44f3e5d5c3b4756","head":{"label":"MTG:username-field-fixes","ref":"username-field-fixes","sha":"af9cf01df539254e98fd0fa7b44f3e5d5c3b4756","user":{"login":"MTG","id":2728938,"avatar_url":"https://avatars0.githubusercontent.com/u/2728938?v=4","gravatar_id":"","url":"https://api.github.com/users/MTG","html_url":"https://github.com/MTG","followers_url":"https://api.github.com/users/MTG/followers","following_url":"https://api.github.com/users/MTG/following{/other_user}","gists_url":"https://api.github.com/users/MTG/gists{/gist_id}","starred_url":"https://api.github.com/users/MTG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MTG/subscriptions","organizations_url":"https://api.github.com/users/MTG/orgs","repos_url":"https://api.github.com/users/MTG/repos","events_url":"https://api.github.com/users/MTG/events{/privacy}","received_events_url":"https://api.github.com/users/MTG/received_events","type":"Organization","site_admin":false},"repo":{"id":6583992,"name":"freesound","full_name":"MTG/freesound","owner":{"login":"MTG","id":2728938,"avatar_url":"https://avatars0.githubusercontent.com/u/2728938?v=4","gravatar_id":"","url":"https://api.github.com/users/MTG","html_url":"https://github.com/MTG","followers_url":"https://api.github.com/users/MTG/followers","following_url":"https://api.github.com/users/MTG/following{/other_user}","gists_url":"https://api.github.com/users/MTG/gists{/gist_id}","starred_url":"https://api.github.com/users/MTG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MTG/subscriptions","organizations_url":"https://api.github.com/users/MTG/orgs","repos_url":"https://api.github.com/users/MTG/repos","events_url":"https://api.github.com/users/MTG/events{/privacy}","received_events_url":"https://api.github.com/users/MTG/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MTG/freesound","description":"The freesound.org website","fork":false,"url":"https://api.github.com/repos/MTG/freesound","forks_url":"https://api.github.com/repos/MTG/freesound/forks","keys_url":"https://api.github.com/repos/MTG/freesound/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MTG/freesound/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MTG/freesound/teams","hooks_url":"https://api.github.com/repos/MTG/freesound/hooks","issue_events_url":"https://api.github.com/repos/MTG/freesound/issues/events{/number}","events_url":"https://api.github.com/repos/MTG/freesound/events","assignees_url":"https://api.github.com/repos/MTG/freesound/assignees{/user}","branches_url":"https://api.github.com/repos/MTG/freesound/branches{/branch}","tags_url":"https://api.github.com/repos/MTG/freesound/tags","blobs_url":"https://api.github.com/repos/MTG/freesound/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MTG/freesound/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MTG/freesound/git/refs{/sha}","trees_url":"https://api.github.com/repos/MTG/freesound/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MTG/freesound/statuses/{sha}","languages_url":"https://api.github.com/repos/MTG/freesound/languages","stargazers_url":"https://api.github.com/repos/MTG/freesound/stargazers","contributors_url":"https://api.github.com/repos/MTG/freesound/contributors","subscribers_url":"https://api.github.com/repos/MTG/freesound/subscribers","subscription_url":"https://api.github.com/repos/MTG/freesound/subscription","commits_url":"https://api.github.com/repos/MTG/freesound/commits{/sha}","git_commits_url":"https://api.github.com/repos/MTG/freesound/git/commits{/sha}","comments_url":"https://api.github.com/repos/MTG/freesound/comments{/number}","issue_comment_url":"https://api.github.com/repos/MTG/freesound/issues/comments{/number}","contents_url":"https://api.github.com/repos/MTG/freesound/contents/{+path}","compare_url":"https://api.github.com/repos/MTG/freesound/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MTG/freesound/merges","archive_url":"https://api.github.com/repos/MTG/freesound/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MTG/freesound/downloads","issues_url":"https://api.github.com/repos/MTG/freesound/issues{/number}","pulls_url":"https://api.github.com/repos/MTG/freesound/pulls{/number}","milestones_url":"https://api.github.com/repos/MTG/freesound/milestones{/number}","notifications_url":"https://api.github.com/repos/MTG/freesound/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MTG/freesound/labels{/name}","releases_url":"https://api.github.com/repos/MTG/freesound/releases{/id}","deployments_url":"https://api.github.com/repos/MTG/freesound/deployments","created_at":"2012-11-07T18:25:03Z","updated_at":"2018-02-14T12:32:05Z","pushed_at":"2018-02-15T13:43:23Z","git_url":"git://github.com/MTG/freesound.git","ssh_url":"git@github.com:MTG/freesound.git","clone_url":"https://github.com/MTG/freesound.git","svn_url":"https://github.com/MTG/freesound","homepage":"https://freesound.org","size":58244,"stargazers_count":140,"watchers_count":140,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":101,"license":null,"forks":34,"open_issues":101,"watchers":140,"default_branch":"master"}},"base":{"label":"MTG:master","ref":"master","sha":"79883de99be50baa57ae1628675ffc3fec733861","user":{"login":"MTG","id":2728938,"avatar_url":"https://avatars0.githubusercontent.com/u/2728938?v=4","gravatar_id":"","url":"https://api.github.com/users/MTG","html_url":"https://github.com/MTG","followers_url":"https://api.github.com/users/MTG/followers","following_url":"https://api.github.com/users/MTG/following{/other_user}","gists_url":"https://api.github.com/users/MTG/gists{/gist_id}","starred_url":"https://api.github.com/users/MTG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MTG/subscriptions","organizations_url":"https://api.github.com/users/MTG/orgs","repos_url":"https://api.github.com/users/MTG/repos","events_url":"https://api.github.com/users/MTG/events{/privacy}","received_events_url":"https://api.github.com/users/MTG/received_events","type":"Organization","site_admin":false},"repo":{"id":6583992,"name":"freesound","full_name":"MTG/freesound","owner":{"login":"MTG","id":2728938,"avatar_url":"https://avatars0.githubusercontent.com/u/2728938?v=4","gravatar_id":"","url":"https://api.github.com/users/MTG","html_url":"https://github.com/MTG","followers_url":"https://api.github.com/users/MTG/followers","following_url":"https://api.github.com/users/MTG/following{/other_user}","gists_url":"https://api.github.com/users/MTG/gists{/gist_id}","starred_url":"https://api.github.com/users/MTG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MTG/subscriptions","organizations_url":"https://api.github.com/users/MTG/orgs","repos_url":"https://api.github.com/users/MTG/repos","events_url":"https://api.github.com/users/MTG/events{/privacy}","received_events_url":"https://api.github.com/users/MTG/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MTG/freesound","description":"The freesound.org website","fork":false,"url":"https://api.github.com/repos/MTG/freesound","forks_url":"https://api.github.com/repos/MTG/freesound/forks","keys_url":"https://api.github.com/repos/MTG/freesound/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MTG/freesound/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MTG/freesound/teams","hooks_url":"https://api.github.com/repos/MTG/freesound/hooks","issue_events_url":"https://api.github.com/repos/MTG/freesound/issues/events{/number}","events_url":"https://api.github.com/repos/MTG/freesound/events","assignees_url":"https://api.github.com/repos/MTG/freesound/assignees{/user}","branches_url":"https://api.github.com/repos/MTG/freesound/branches{/branch}","tags_url":"https://api.github.com/repos/MTG/freesound/tags","blobs_url":"https://api.github.com/repos/MTG/freesound/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MTG/freesound/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MTG/freesound/git/refs{/sha}","trees_url":"https://api.github.com/repos/MTG/freesound/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MTG/freesound/statuses/{sha}","languages_url":"https://api.github.com/repos/MTG/freesound/languages","stargazers_url":"https://api.github.com/repos/MTG/freesound/stargazers","contributors_url":"https://api.github.com/repos/MTG/freesound/contributors","subscribers_url":"https://api.github.com/repos/MTG/freesound/subscribers","subscription_url":"https://api.github.com/repos/MTG/freesound/subscription","commits_url":"https://api.github.com/repos/MTG/freesound/commits{/sha}","git_commits_url":"https://api.github.com/repos/MTG/freesound/git/commits{/sha}","comments_url":"https://api.github.com/repos/MTG/freesound/comments{/number}","issue_comment_url":"https://api.github.com/repos/MTG/freesound/issues/comments{/number}","contents_url":"https://api.github.com/repos/MTG/freesound/contents/{+path}","compare_url":"https://api.github.com/repos/MTG/freesound/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MTG/freesound/merges","archive_url":"https://api.github.com/repos/MTG/freesound/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MTG/freesound/downloads","issues_url":"https://api.github.com/repos/MTG/freesound/issues{/number}","pulls_url":"https://api.github.com/repos/MTG/freesound/pulls{/number}","milestones_url":"https://api.github.com/repos/MTG/freesound/milestones{/number}","notifications_url":"https://api.github.com/repos/MTG/freesound/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MTG/freesound/labels{/name}","releases_url":"https://api.github.com/repos/MTG/freesound/releases{/id}","deployments_url":"https://api.github.com/repos/MTG/freesound/deployments","created_at":"2012-11-07T18:25:03Z","updated_at":"2018-02-14T12:32:05Z","pushed_at":"2018-02-15T13:43:23Z","git_url":"git://github.com/MTG/freesound.git","ssh_url":"git@github.com:MTG/freesound.git","clone_url":"https://github.com/MTG/freesound.git","svn_url":"https://github.com/MTG/freesound","homepage":"https://freesound.org","size":58244,"stargazers_count":140,"watchers_count":140,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":101,"license":null,"forks":34,"open_issues":101,"watchers":140,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MTG/freesound/pulls/1125"},"html":{"href":"https://github.com/MTG/freesound/pull/1125"},"issue":{"href":"https://api.github.com/repos/MTG/freesound/issues/1125"},"comments":{"href":"https://api.github.com/repos/MTG/freesound/issues/1125/comments"},"review_comments":{"href":"https://api.github.com/repos/MTG/freesound/pulls/1125/comments"},"review_comment":{"href":"https://api.github.com/repos/MTG/freesound/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MTG/freesound/pulls/1125/commits"},"statuses":{"href":"https://api.github.com/repos/MTG/freesound/statuses/af9cf01df539254e98fd0fa7b44f3e5d5c3b4756"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ffont"}}