{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/mozillians/pulls/comments/57021675","id":57021675,"diff_hunk":"@@ -65,34 +53,113 @@ def test_group_curators_validation(self):\n \n         # Update form without adding curators\n         form_data = {'name': 'test_group',\n-                     'accepting_new_members': 'by_request',\n-                     'new_member_criteria': 'some criteria',\n                      'curators': []}\n-        form = GroupForm(instance=group, data=form_data)\n+        form = forms.GroupCuratorsForm(instance=group, data=form_data)\n \n         ok_(not form.is_valid())\n         eq_(form.errors, {'curators': [u'The group must have at least one curator.']})\n \n-    def test_new_group_without_curators(self):\n-        # Create a new group without curators\n-        form_data = {'name': 'test_group',\n-                     'accepting_new_members': 'by_request',\n-                     'new_member_criteria': 'some criteria',\n-                     'curators': []}\n-        form = GroupForm(data=form_data)\n-\n-        ok_(not form.is_valid())\n-        eq_(form.errors, {'curators': [u'The group must have at least one curator.']})\n \n-    def test_create_new_group(self):\n-        # Create a new group without curators\n-        curator = UserFactory.create(vouched=True)\n-        form_data = {'name': 'test_group',\n-                     'accepting_new_members': 'by_request',\n-                     'new_member_criteria': 'some criteria',\n-                     'curators': [curator.id]}\n-        form = GroupForm(data=form_data)\n+def test_edit_group_forms(form_class, instance, data, request=None, valid=True):\n+    form = form_class(instance=instance, data=data, request=request)\n \n+    if valid:\n         ok_(form.is_valid())\n         form.save()\n-        eq_(Group.objects.all().count(), 1)\n+\n+        # Get the object from the db\n+        obj = instance._meta.model.objects.get(pk=instance.pk)\n+        # compare the value of each field in the object with the ones in the data dict\n+        for field in [f for f in obj._meta.fields if f.name in data.keys()]:\n+            eq_(field.value_from_object(obj), data[field.name])\n+    else:\n+        ok_(not form.is_valid())\n+\n+    return form\n+\n+\n+class GroupEditFormTests(TestCase):\n+\n+    def test_edit_basic_form_with_data(self):\n+        group = GroupFactory.create()\n+        data = {'name': 'test group',\n+                'description': 'sample description',\n+                'irc_channel': 'foobar',\n+                'website': 'https://example.com',\n+                'wiki': 'https://example-wiki.com'}\n+        test_edit_group_forms(forms.GroupBasicForm, group, data)\n+\n+    def test_edit_description_without_data(self):\n+        group = GroupFactory.create()\n+        data = {}\n+        form = test_edit_group_forms(forms.GroupBasicForm, group, data, None, False)\n+        eq_(form.errors, {'name': [u'This field is required.']})\n+\n+    def test_edit_curators(self):\n+        curator = UserFactory.create()\n+        group = GroupFactory.create()\n+\n+        data = {'curators': [curator.id]}\n+        test_edit_group_forms(forms.GroupCuratorsForm, group, data)\n+\n+    def test_edit_terms(self):\n+        group = GroupFactory.create()\n+        data = {'terms': 'foobar'}\n+        test_edit_group_forms(forms.GroupTermsForm, group, data)\n+\n+    def test_edit_terms_without_data(self):\n+        group = GroupFactory.create()\n+        data = {}\n+        test_edit_group_forms(forms.GroupTermsForm, group, data)\n+\n+    def test_edit_invalidation(self):\n+        group = GroupFactory.create()\n+        data = {'invalidation_days': 5}\n+        test_edit_group_forms(forms.GroupInvalidationForm, group, data)\n+\n+    def test_edit_invitation_without_data(self):\n+        group = GroupFactory.create()\n+        data = {}\n+        test_edit_group_forms(forms.GroupInvalidationForm, group, data)","path":"mozillians/groups/tests/test_forms.py","position":170,"original_position":170,"commit_id":"9aaba3a28233deb7dcf9667cf1bbd58785cd8281","original_commit_id":"9aaba3a28233deb7dcf9667cf1bbd58785cd8281","user":{"login":"johngian","id":835321,"avatar_url":"https://avatars.githubusercontent.com/u/835321?v=3","gravatar_id":"","url":"https://api.github.com/users/johngian","html_url":"https://github.com/johngian","followers_url":"https://api.github.com/users/johngian/followers","following_url":"https://api.github.com/users/johngian/following{/other_user}","gists_url":"https://api.github.com/users/johngian/gists{/gist_id}","starred_url":"https://api.github.com/users/johngian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johngian/subscriptions","organizations_url":"https://api.github.com/users/johngian/orgs","repos_url":"https://api.github.com/users/johngian/repos","events_url":"https://api.github.com/users/johngian/events{/privacy}","received_events_url":"https://api.github.com/users/johngian/received_events","type":"User","site_admin":false},"body":"Here you are testing the ``GroupInvalidationForm`` but the name is about invitations.","created_at":"2016-03-22T16:42:25Z","updated_at":"2016-03-22T16:42:25Z","html_url":"https://github.com/mozilla/mozillians/pull/1392#discussion_r57021675","pull_request_url":"https://api.github.com/repos/mozilla/mozillians/pulls/1392","_links":{"self":{"href":"https://api.github.com/repos/mozilla/mozillians/pulls/comments/57021675"},"html":{"href":"https://github.com/mozilla/mozillians/pull/1392#discussion_r57021675"},"pull_request":{"href":"https://api.github.com/repos/mozilla/mozillians/pulls/1392"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/mozillians/pulls/1392","id":63618297,"html_url":"https://github.com/mozilla/mozillians/pull/1392","diff_url":"https://github.com/mozilla/mozillians/pull/1392.diff","patch_url":"https://github.com/mozilla/mozillians/pull/1392.patch","issue_url":"https://api.github.com/repos/mozilla/mozillians/issues/1392","number":1392,"state":"open","locked":false,"title":"Multiple fixes for group refactoring","user":{"login":"akatsoulas","id":900565,"avatar_url":"https://avatars.githubusercontent.com/u/900565?v=3","gravatar_id":"","url":"https://api.github.com/users/akatsoulas","html_url":"https://github.com/akatsoulas","followers_url":"https://api.github.com/users/akatsoulas/followers","following_url":"https://api.github.com/users/akatsoulas/following{/other_user}","gists_url":"https://api.github.com/users/akatsoulas/gists{/gist_id}","starred_url":"https://api.github.com/users/akatsoulas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akatsoulas/subscriptions","organizations_url":"https://api.github.com/users/akatsoulas/orgs","repos_url":"https://api.github.com/users/akatsoulas/repos","events_url":"https://api.github.com/users/akatsoulas/events{/privacy}","received_events_url":"https://api.github.com/users/akatsoulas/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-21T19:24:41Z","updated_at":"2016-03-22T16:42:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b35763c8193c706a24c58f31ac3fc9255cdc4a1e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/mozillians/pulls/1392/commits","review_comments_url":"https://api.github.com/repos/mozilla/mozillians/pulls/1392/comments","review_comment_url":"https://api.github.com/repos/mozilla/mozillians/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/mozillians/issues/1392/comments","statuses_url":"https://api.github.com/repos/mozilla/mozillians/statuses/9aaba3a28233deb7dcf9667cf1bbd58785cd8281","head":{"label":"akatsoulas:1250876-group-edit-refactor","ref":"1250876-group-edit-refactor","sha":"9aaba3a28233deb7dcf9667cf1bbd58785cd8281","user":{"login":"akatsoulas","id":900565,"avatar_url":"https://avatars.githubusercontent.com/u/900565?v=3","gravatar_id":"","url":"https://api.github.com/users/akatsoulas","html_url":"https://github.com/akatsoulas","followers_url":"https://api.github.com/users/akatsoulas/followers","following_url":"https://api.github.com/users/akatsoulas/following{/other_user}","gists_url":"https://api.github.com/users/akatsoulas/gists{/gist_id}","starred_url":"https://api.github.com/users/akatsoulas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akatsoulas/subscriptions","organizations_url":"https://api.github.com/users/akatsoulas/orgs","repos_url":"https://api.github.com/users/akatsoulas/repos","events_url":"https://api.github.com/users/akatsoulas/events{/privacy}","received_events_url":"https://api.github.com/users/akatsoulas/received_events","type":"User","site_admin":false},"repo":{"id":9349413,"name":"mozillians","full_name":"akatsoulas/mozillians","owner":{"login":"akatsoulas","id":900565,"avatar_url":"https://avatars.githubusercontent.com/u/900565?v=3","gravatar_id":"","url":"https://api.github.com/users/akatsoulas","html_url":"https://github.com/akatsoulas","followers_url":"https://api.github.com/users/akatsoulas/followers","following_url":"https://api.github.com/users/akatsoulas/following{/other_user}","gists_url":"https://api.github.com/users/akatsoulas/gists{/gist_id}","starred_url":"https://api.github.com/users/akatsoulas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akatsoulas/subscriptions","organizations_url":"https://api.github.com/users/akatsoulas/orgs","repos_url":"https://api.github.com/users/akatsoulas/repos","events_url":"https://api.github.com/users/akatsoulas/events{/privacy}","received_events_url":"https://api.github.com/users/akatsoulas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/akatsoulas/mozillians","description":"Mozilla community directory -- A centralized directory of all Mozilla contributors!","fork":true,"url":"https://api.github.com/repos/akatsoulas/mozillians","forks_url":"https://api.github.com/repos/akatsoulas/mozillians/forks","keys_url":"https://api.github.com/repos/akatsoulas/mozillians/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akatsoulas/mozillians/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akatsoulas/mozillians/teams","hooks_url":"https://api.github.com/repos/akatsoulas/mozillians/hooks","issue_events_url":"https://api.github.com/repos/akatsoulas/mozillians/issues/events{/number}","events_url":"https://api.github.com/repos/akatsoulas/mozillians/events","assignees_url":"https://api.github.com/repos/akatsoulas/mozillians/assignees{/user}","branches_url":"https://api.github.com/repos/akatsoulas/mozillians/branches{/branch}","tags_url":"https://api.github.com/repos/akatsoulas/mozillians/tags","blobs_url":"https://api.github.com/repos/akatsoulas/mozillians/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akatsoulas/mozillians/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akatsoulas/mozillians/git/refs{/sha}","trees_url":"https://api.github.com/repos/akatsoulas/mozillians/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akatsoulas/mozillians/statuses/{sha}","languages_url":"https://api.github.com/repos/akatsoulas/mozillians/languages","stargazers_url":"https://api.github.com/repos/akatsoulas/mozillians/stargazers","contributors_url":"https://api.github.com/repos/akatsoulas/mozillians/contributors","subscribers_url":"https://api.github.com/repos/akatsoulas/mozillians/subscribers","subscription_url":"https://api.github.com/repos/akatsoulas/mozillians/subscription","commits_url":"https://api.github.com/repos/akatsoulas/mozillians/commits{/sha}","git_commits_url":"https://api.github.com/repos/akatsoulas/mozillians/git/commits{/sha}","comments_url":"https://api.github.com/repos/akatsoulas/mozillians/comments{/number}","issue_comment_url":"https://api.github.com/repos/akatsoulas/mozillians/issues/comments{/number}","contents_url":"https://api.github.com/repos/akatsoulas/mozillians/contents/{+path}","compare_url":"https://api.github.com/repos/akatsoulas/mozillians/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akatsoulas/mozillians/merges","archive_url":"https://api.github.com/repos/akatsoulas/mozillians/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akatsoulas/mozillians/downloads","issues_url":"https://api.github.com/repos/akatsoulas/mozillians/issues{/number}","pulls_url":"https://api.github.com/repos/akatsoulas/mozillians/pulls{/number}","milestones_url":"https://api.github.com/repos/akatsoulas/mozillians/milestones{/number}","notifications_url":"https://api.github.com/repos/akatsoulas/mozillians/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akatsoulas/mozillians/labels{/name}","releases_url":"https://api.github.com/repos/akatsoulas/mozillians/releases{/id}","deployments_url":"https://api.github.com/repos/akatsoulas/mozillians/deployments","created_at":"2013-04-10T15:34:24Z","updated_at":"2015-04-27T09:37:22Z","pushed_at":"2016-03-22T14:42:26Z","git_url":"git://github.com/akatsoulas/mozillians.git","ssh_url":"git@github.com:akatsoulas/mozillians.git","clone_url":"https://github.com/akatsoulas/mozillians.git","svn_url":"https://github.com/akatsoulas/mozillians","homepage":"https://mozillians.org/","size":31868,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"89856189c7944bfb28de745dca4b16b3be65edc9","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1799884,"name":"mozillians","full_name":"mozilla/mozillians","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/mozillians","description":"Mozilla community directory -- A centralized directory of all Mozilla contributors!","fork":false,"url":"https://api.github.com/repos/mozilla/mozillians","forks_url":"https://api.github.com/repos/mozilla/mozillians/forks","keys_url":"https://api.github.com/repos/mozilla/mozillians/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/mozillians/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/mozillians/teams","hooks_url":"https://api.github.com/repos/mozilla/mozillians/hooks","issue_events_url":"https://api.github.com/repos/mozilla/mozillians/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/mozillians/events","assignees_url":"https://api.github.com/repos/mozilla/mozillians/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/mozillians/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/mozillians/tags","blobs_url":"https://api.github.com/repos/mozilla/mozillians/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/mozillians/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/mozillians/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/mozillians/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/mozillians/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/mozillians/languages","stargazers_url":"https://api.github.com/repos/mozilla/mozillians/stargazers","contributors_url":"https://api.github.com/repos/mozilla/mozillians/contributors","subscribers_url":"https://api.github.com/repos/mozilla/mozillians/subscribers","subscription_url":"https://api.github.com/repos/mozilla/mozillians/subscription","commits_url":"https://api.github.com/repos/mozilla/mozillians/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/mozillians/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/mozillians/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/mozillians/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/mozillians/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/mozillians/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/mozillians/merges","archive_url":"https://api.github.com/repos/mozilla/mozillians/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/mozillians/downloads","issues_url":"https://api.github.com/repos/mozilla/mozillians/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/mozillians/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/mozillians/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/mozillians/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/mozillians/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/mozillians/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/mozillians/deployments","created_at":"2011-05-25T16:38:54Z","updated_at":"2016-02-07T08:20:41Z","pushed_at":"2016-03-22T16:01:56Z","git_url":"git://github.com/mozilla/mozillians.git","ssh_url":"git@github.com:mozilla/mozillians.git","clone_url":"https://github.com/mozilla/mozillians.git","svn_url":"https://github.com/mozilla/mozillians","homepage":"https://mozillians.org/","size":33822,"stargazers_count":171,"watchers_count":171,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":286,"mirror_url":null,"open_issues_count":20,"forks":286,"open_issues":20,"watchers":171,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/mozillians/pulls/1392"},"html":{"href":"https://github.com/mozilla/mozillians/pull/1392"},"issue":{"href":"https://api.github.com/repos/mozilla/mozillians/issues/1392"},"comments":{"href":"https://api.github.com/repos/mozilla/mozillians/issues/1392/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/mozillians/pulls/1392/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/mozillians/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/mozillians/pulls/1392/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/mozillians/statuses/9aaba3a28233deb7dcf9667cf1bbd58785cd8281"}}}}