{"action":"created","comment":{"url":"https://api.github.com/repos/bmun/huxley/pulls/comments/67625948","id":67625948,"diff_hunk":"@@ -0,0 +1,90 @@\n+# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved.\n+# Use of this source code is governed by a BSD License (see LICENSE).\n+\n+from huxley.api.tests import ListAPITestCase, UpdateAPITestCase\n+from huxley.core.models import Assignment, Delegate, School\n+from huxley.utils.test import (TestCommittees, TestCountries, TestSchools,\n+                               TestUsers, TestAssignments, TestDelegates)\n+\n+\n+class SchoolDelegateGetTestCase(ListAPITestCase):\n+    url_name = 'api:school_delegates'\n+    is_resource = True\n+\n+    def setUp(self):\n+        self.user = TestUsers.new_user(username='regular', password='user')\n+        self.school = TestSchools.new_school(user=self.user)\n+        self.country = TestCountries.new_country()\n+        self.committee1 = TestCommittees.new_committee()\n+        self.committee2 = TestCommittees.new_committee()\n+        self.assignment1 = TestAssignments.new_assignment(\n+            committee=self.committee1,\n+            country=self.country,\n+            school=self.school,\n+        )\n+        self.assignment2 = TestAssignments.new_assignment(\n+            committee=self.committee2,\n+            country=self.country,\n+            school=self.school,\n+        )\n+        self.delegate1 = TestDelegates.new_delegate(\n+            assignment=self.assignment1,\n+        )\n+        self.delegate2 = TestDelegates.new_delegate(\n+            assignment=self.assignment2,\n+            name='Trevor Dowds',\n+            email='t@dowds.com',\n+            summary='Good!'\n+        )\n+\n+    def test_anonymous_user(self):\n+        '''It rejects a request from an anonymous user.'''\n+        response = self.get_response(self.school.id)\n+        self.assertNotAuthenticated(response)\n+\n+    def test_advisor(self):\n+        '''It returns the assignments for the school's advisor.'''\n+        self.client.login(username='regular', password='user')\n+\n+        response = self.get_response(self.school.id)\n+        self.assert_delegate_equal(response)\n+\n+    def test_other_user(self):\n+        '''It rejects a request from another user.'''\n+        user2 = TestUsers.new_user(username='another', password='user')\n+        TestSchools.new_school(user=user2)\n+        self.client.login(username='another', password='user')\n+\n+        response = self.get_response(self.school.id)\n+        self.assertPermissionDenied(response)\n+\n+    def test_superuser(self):\n+        '''It returns the assignments for a superuser.'''\n+        TestUsers.new_superuser(username='test', password='user')\n+        self.client.login(username='test', password='user')\n+\n+        response = self.get_response(self.school.id)\n+        self.assert_delegate_equal(response)\n+\n+    def assert_delegate_equal(self, response):\n+        '''Assert that the response contains the assignments in order.'''\n+        response.data[0].pop('created_at')\n+        response.data[1].pop('created_at')\n+        self.assertEqual(dict(response.data[0]),\n+            {\n+                'id': self.delegate1.id,\n+                'assignment':self.assignment1.id,\n+                'name':unicode(self.delegate1.name),","path":"huxley/api/tests/school/test_school_delegates.py","position":77,"original_position":77,"commit_id":"8da08d5aa9e9b9eb92e11bb40eefea1df3a52295","original_commit_id":"8da08d5aa9e9b9eb92e11bb40eefea1df3a52295","user":{"login":"kmeht","id":1120478,"avatar_url":"https://avatars.githubusercontent.com/u/1120478?v=3","gravatar_id":"","url":"https://api.github.com/users/kmeht","html_url":"https://github.com/kmeht","followers_url":"https://api.github.com/users/kmeht/followers","following_url":"https://api.github.com/users/kmeht/following{/other_user}","gists_url":"https://api.github.com/users/kmeht/gists{/gist_id}","starred_url":"https://api.github.com/users/kmeht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmeht/subscriptions","organizations_url":"https://api.github.com/users/kmeht/orgs","repos_url":"https://api.github.com/users/kmeht/repos","events_url":"https://api.github.com/users/kmeht/events{/privacy}","received_events_url":"https://api.github.com/users/kmeht/received_events","type":"User","site_admin":false},"body":"nit: space after colon, same for all properties in this dictionary","created_at":"2016-06-19T23:41:13Z","updated_at":"2016-06-19T23:41:13Z","html_url":"https://github.com/bmun/huxley/pull/468#discussion_r67625948","pull_request_url":"https://api.github.com/repos/bmun/huxley/pulls/468","_links":{"self":{"href":"https://api.github.com/repos/bmun/huxley/pulls/comments/67625948"},"html":{"href":"https://github.com/bmun/huxley/pull/468#discussion_r67625948"},"pull_request":{"href":"https://api.github.com/repos/bmun/huxley/pulls/468"}}},"pull_request":{"url":"https://api.github.com/repos/bmun/huxley/pulls/468","id":71944171,"html_url":"https://github.com/bmun/huxley/pull/468","diff_url":"https://github.com/bmun/huxley/pull/468.diff","patch_url":"https://github.com/bmun/huxley/pull/468.patch","issue_url":"https://api.github.com/repos/bmun/huxley/issues/468","number":468,"state":"open","locked":false,"title":"Advisor roster view additions","user":{"login":"jmosky12","id":9645207,"avatar_url":"https://avatars.githubusercontent.com/u/9645207?v=3","gravatar_id":"","url":"https://api.github.com/users/jmosky12","html_url":"https://github.com/jmosky12","followers_url":"https://api.github.com/users/jmosky12/followers","following_url":"https://api.github.com/users/jmosky12/following{/other_user}","gists_url":"https://api.github.com/users/jmosky12/gists{/gist_id}","starred_url":"https://api.github.com/users/jmosky12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmosky12/subscriptions","organizations_url":"https://api.github.com/users/jmosky12/orgs","repos_url":"https://api.github.com/users/jmosky12/repos","events_url":"https://api.github.com/users/jmosky12/events{/privacy}","received_events_url":"https://api.github.com/users/jmosky12/received_events","type":"User","site_admin":false},"body":"*Added navbar link\r\n*Created Add Delegate Button and Delete Delegate Button","created_at":"2016-05-30T23:37:22Z","updated_at":"2016-06-19T23:41:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7f0d95bede8db9e5df3e9a79c01ce193b53e4dd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bmun/huxley/pulls/468/commits","review_comments_url":"https://api.github.com/repos/bmun/huxley/pulls/468/comments","review_comment_url":"https://api.github.com/repos/bmun/huxley/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bmun/huxley/issues/468/comments","statuses_url":"https://api.github.com/repos/bmun/huxley/statuses/8da08d5aa9e9b9eb92e11bb40eefea1df3a52295","head":{"label":"jmosky12:AdvisorRosterViewAdditions","ref":"AdvisorRosterViewAdditions","sha":"8da08d5aa9e9b9eb92e11bb40eefea1df3a52295","user":{"login":"jmosky12","id":9645207,"avatar_url":"https://avatars.githubusercontent.com/u/9645207?v=3","gravatar_id":"","url":"https://api.github.com/users/jmosky12","html_url":"https://github.com/jmosky12","followers_url":"https://api.github.com/users/jmosky12/followers","following_url":"https://api.github.com/users/jmosky12/following{/other_user}","gists_url":"https://api.github.com/users/jmosky12/gists{/gist_id}","starred_url":"https://api.github.com/users/jmosky12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmosky12/subscriptions","organizations_url":"https://api.github.com/users/jmosky12/orgs","repos_url":"https://api.github.com/users/jmosky12/repos","events_url":"https://api.github.com/users/jmosky12/events{/privacy}","received_events_url":"https://api.github.com/users/jmosky12/received_events","type":"User","site_admin":false},"repo":{"id":26415218,"name":"huxley","full_name":"jmosky12/huxley","owner":{"login":"jmosky12","id":9645207,"avatar_url":"https://avatars.githubusercontent.com/u/9645207?v=3","gravatar_id":"","url":"https://api.github.com/users/jmosky12","html_url":"https://github.com/jmosky12","followers_url":"https://api.github.com/users/jmosky12/followers","following_url":"https://api.github.com/users/jmosky12/following{/other_user}","gists_url":"https://api.github.com/users/jmosky12/gists{/gist_id}","starred_url":"https://api.github.com/users/jmosky12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmosky12/subscriptions","organizations_url":"https://api.github.com/users/jmosky12/orgs","repos_url":"https://api.github.com/users/jmosky12/repos","events_url":"https://api.github.com/users/jmosky12/events{/privacy}","received_events_url":"https://api.github.com/users/jmosky12/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmosky12/huxley","description":"Conference management system for Berkeley Model United Nations.","fork":true,"url":"https://api.github.com/repos/jmosky12/huxley","forks_url":"https://api.github.com/repos/jmosky12/huxley/forks","keys_url":"https://api.github.com/repos/jmosky12/huxley/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmosky12/huxley/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmosky12/huxley/teams","hooks_url":"https://api.github.com/repos/jmosky12/huxley/hooks","issue_events_url":"https://api.github.com/repos/jmosky12/huxley/issues/events{/number}","events_url":"https://api.github.com/repos/jmosky12/huxley/events","assignees_url":"https://api.github.com/repos/jmosky12/huxley/assignees{/user}","branches_url":"https://api.github.com/repos/jmosky12/huxley/branches{/branch}","tags_url":"https://api.github.com/repos/jmosky12/huxley/tags","blobs_url":"https://api.github.com/repos/jmosky12/huxley/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmosky12/huxley/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmosky12/huxley/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmosky12/huxley/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmosky12/huxley/statuses/{sha}","languages_url":"https://api.github.com/repos/jmosky12/huxley/languages","stargazers_url":"https://api.github.com/repos/jmosky12/huxley/stargazers","contributors_url":"https://api.github.com/repos/jmosky12/huxley/contributors","subscribers_url":"https://api.github.com/repos/jmosky12/huxley/subscribers","subscription_url":"https://api.github.com/repos/jmosky12/huxley/subscription","commits_url":"https://api.github.com/repos/jmosky12/huxley/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmosky12/huxley/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmosky12/huxley/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmosky12/huxley/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmosky12/huxley/contents/{+path}","compare_url":"https://api.github.com/repos/jmosky12/huxley/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmosky12/huxley/merges","archive_url":"https://api.github.com/repos/jmosky12/huxley/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmosky12/huxley/downloads","issues_url":"https://api.github.com/repos/jmosky12/huxley/issues{/number}","pulls_url":"https://api.github.com/repos/jmosky12/huxley/pulls{/number}","milestones_url":"https://api.github.com/repos/jmosky12/huxley/milestones{/number}","notifications_url":"https://api.github.com/repos/jmosky12/huxley/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmosky12/huxley/labels{/name}","releases_url":"https://api.github.com/repos/jmosky12/huxley/releases{/id}","deployments_url":"https://api.github.com/repos/jmosky12/huxley/deployments","created_at":"2014-11-10T01:00:49Z","updated_at":"2014-11-10T00:58:44Z","pushed_at":"2016-06-19T20:35:01Z","git_url":"git://github.com/jmosky12/huxley.git","ssh_url":"git@github.com:jmosky12/huxley.git","clone_url":"https://github.com/jmosky12/huxley.git","svn_url":"https://github.com/jmosky12/huxley","homepage":"","size":7981,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"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":"bmun:master","ref":"master","sha":"30f0022462371ee93d419260db12b3faf7ff5e1e","user":{"login":"bmun","id":4782099,"avatar_url":"https://avatars.githubusercontent.com/u/4782099?v=3","gravatar_id":"","url":"https://api.github.com/users/bmun","html_url":"https://github.com/bmun","followers_url":"https://api.github.com/users/bmun/followers","following_url":"https://api.github.com/users/bmun/following{/other_user}","gists_url":"https://api.github.com/users/bmun/gists{/gist_id}","starred_url":"https://api.github.com/users/bmun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmun/subscriptions","organizations_url":"https://api.github.com/users/bmun/orgs","repos_url":"https://api.github.com/users/bmun/repos","events_url":"https://api.github.com/users/bmun/events{/privacy}","received_events_url":"https://api.github.com/users/bmun/received_events","type":"Organization","site_admin":false},"repo":{"id":4620840,"name":"huxley","full_name":"bmun/huxley","owner":{"login":"bmun","id":4782099,"avatar_url":"https://avatars.githubusercontent.com/u/4782099?v=3","gravatar_id":"","url":"https://api.github.com/users/bmun","html_url":"https://github.com/bmun","followers_url":"https://api.github.com/users/bmun/followers","following_url":"https://api.github.com/users/bmun/following{/other_user}","gists_url":"https://api.github.com/users/bmun/gists{/gist_id}","starred_url":"https://api.github.com/users/bmun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmun/subscriptions","organizations_url":"https://api.github.com/users/bmun/orgs","repos_url":"https://api.github.com/users/bmun/repos","events_url":"https://api.github.com/users/bmun/events{/privacy}","received_events_url":"https://api.github.com/users/bmun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bmun/huxley","description":"Conference management system for Berkeley Model United Nations.","fork":false,"url":"https://api.github.com/repos/bmun/huxley","forks_url":"https://api.github.com/repos/bmun/huxley/forks","keys_url":"https://api.github.com/repos/bmun/huxley/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bmun/huxley/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bmun/huxley/teams","hooks_url":"https://api.github.com/repos/bmun/huxley/hooks","issue_events_url":"https://api.github.com/repos/bmun/huxley/issues/events{/number}","events_url":"https://api.github.com/repos/bmun/huxley/events","assignees_url":"https://api.github.com/repos/bmun/huxley/assignees{/user}","branches_url":"https://api.github.com/repos/bmun/huxley/branches{/branch}","tags_url":"https://api.github.com/repos/bmun/huxley/tags","blobs_url":"https://api.github.com/repos/bmun/huxley/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bmun/huxley/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bmun/huxley/git/refs{/sha}","trees_url":"https://api.github.com/repos/bmun/huxley/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bmun/huxley/statuses/{sha}","languages_url":"https://api.github.com/repos/bmun/huxley/languages","stargazers_url":"https://api.github.com/repos/bmun/huxley/stargazers","contributors_url":"https://api.github.com/repos/bmun/huxley/contributors","subscribers_url":"https://api.github.com/repos/bmun/huxley/subscribers","subscription_url":"https://api.github.com/repos/bmun/huxley/subscription","commits_url":"https://api.github.com/repos/bmun/huxley/commits{/sha}","git_commits_url":"https://api.github.com/repos/bmun/huxley/git/commits{/sha}","comments_url":"https://api.github.com/repos/bmun/huxley/comments{/number}","issue_comment_url":"https://api.github.com/repos/bmun/huxley/issues/comments{/number}","contents_url":"https://api.github.com/repos/bmun/huxley/contents/{+path}","compare_url":"https://api.github.com/repos/bmun/huxley/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bmun/huxley/merges","archive_url":"https://api.github.com/repos/bmun/huxley/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bmun/huxley/downloads","issues_url":"https://api.github.com/repos/bmun/huxley/issues{/number}","pulls_url":"https://api.github.com/repos/bmun/huxley/pulls{/number}","milestones_url":"https://api.github.com/repos/bmun/huxley/milestones{/number}","notifications_url":"https://api.github.com/repos/bmun/huxley/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bmun/huxley/labels{/name}","releases_url":"https://api.github.com/repos/bmun/huxley/releases{/id}","deployments_url":"https://api.github.com/repos/bmun/huxley/deployments","created_at":"2012-06-11T03:53:05Z","updated_at":"2016-02-25T02:19:35Z","pushed_at":"2016-06-19T20:35:01Z","git_url":"git://github.com/bmun/huxley.git","ssh_url":"git@github.com:bmun/huxley.git","clone_url":"https://github.com/bmun/huxley.git","svn_url":"https://github.com/bmun/huxley","homepage":"","size":8479,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":31,"forks":23,"open_issues":31,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bmun/huxley/pulls/468"},"html":{"href":"https://github.com/bmun/huxley/pull/468"},"issue":{"href":"https://api.github.com/repos/bmun/huxley/issues/468"},"comments":{"href":"https://api.github.com/repos/bmun/huxley/issues/468/comments"},"review_comments":{"href":"https://api.github.com/repos/bmun/huxley/pulls/468/comments"},"review_comment":{"href":"https://api.github.com/repos/bmun/huxley/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bmun/huxley/pulls/468/commits"},"statuses":{"href":"https://api.github.com/repos/bmun/huxley/statuses/8da08d5aa9e9b9eb92e11bb40eefea1df3a52295"}}}}
{"actor":{"display_login":"kmeht"}}