GitHub PullRequestReviewCommentEvent at 2014-02-26 15:00:41
Repository: fuuk
Actor: vzima
Payload: {"comment":{"url":"https://api.github.com/repos/FUUK/fuuk/pulls/comments/10082275","id":10082275,"diff_hunk":"@@ -0,0 +1,387 @@\n+\"\"\"\n+Unittests for views\n+\"\"\"\n+import os\n+from django.conf import settings\n+from datetime import date\n+from django.test import TestCase\n+from django.test.client import Client\n+from django.test.utils import override_settings\n+from fuuk.people.models import (Agency, Article, Attachment, Author, Course, Grant,\n+                                Human, Person, Thesis)\n+\n+@override_settings(LANGUAGE_CODE = 'en')\n+class TestArticleList(TestCase):\n+    def setUp(self):\n+        Article.objects.create(type=\"ARTICLE\", year=\"2013\")\n+        Article.objects.create(type=\"BOOK\", year=\"2005\")\n+        Article.objects.create(type=\"ARTICLE\", year=\"2005\")\n+        Article.objects.create(type=\"ARTICLE\", year=\"2005\")\n+        Article.objects.create(type=\"BOOK\", year=\"2003\")\n+        # These shouldn't get counted\n+        Article.objects.create(type=\"POSTER\", year=\"2002\")\n+        Article.objects.create(type=\"TALK\", year=\"2001\")\n+        Article.objects.create(type=\"INVITED\", year=\"2000\")\n+\n+    def test_basic(self):\n+        response = self.client.get('/people/articles/')\n+        self.assertContains(response, 'Year', count=1)\n+        self.assertEqual(response.context['year'], 2013)\n+        self.assertQuerysetEqual(response.context['years'], ['2013', '2005', '2003'])\n+        self.assertEqual(len(response.context['object_list']), 1)\n+\n+    def test_2005(self):\n+        response = self.client.get('/people/articles/2005/')\n+        self.assertEqual(response.status_code, 200)\n+        self.assertEqual(response.context['year'], 2005)\n+        self.assertEqual(len(response.context['object_list']), 3)\n+\n+    def test_1999(self):\n+        response = self.client.get('/people/articles/1999/')\n+        self.assertEqual(response.status_code, 404)\n+\n+\n+@override_settings(LANGUAGE_CODE = 'en')\n+class TestGrantList(TestCase):\n+    def setUp(self):\n+        # Prepare an author\n+        Person.objects.create(first_name=\"Test\", last_name=\"Person\")\n+        # Prepare agency\n+        Agency.objects.create(name=\"GA\")\n+        # Running\n+        Grant.objects.create(start=\"1990\", end=\"3000\", number=\"1\", author_id=1, agency_id=1)\n+        Grant.objects.create(start=\"2000\", end=(date.today().year + 1), number=\"2\", author_id=1,\n+                             agency_id=1)\n+        # Finished\n+        Grant.objects.create(start=\"1990\", end=(date.today().year - 1), number=\"3\", author_id=1,\n+                             agency_id=1)\n+        Grant.objects.create(start=\"2000\", end=(date.today().year - 2), number=\"4\", author_id=1,\n+                             agency_id=1)\n+        # Too old to be included","path":"fuuk/people/tests/test_views.py","position":60,"original_position":60,"commit_id":"852c3cd5327f163b9353542148447866c7c443c1","original_commit_id":"852c3cd5327f163b9353542148447866c7c443c1","user":{"login":"vzima","id":331955,"avatar_url":"https://identicons.github.com/ff8f6b912d89a1886269b7c471c66e79.png","gravatar_id":null,"url":"https://api.github.com/users/vzima","html_url":"https://github.com/vzima","followers_url":"https://api.github.com/users/vzima/followers","following_url":"https://api.github.com/users/vzima/following{/other_user}","gists_url":"https://api.github.com/users/vzima/gists{/gist_id}","starred_url":"https://api.github.com/users/vzima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vzima/subscriptions","organizations_url":"https://api.github.com/users/vzima/orgs","repos_url":"https://api.github.com/users/vzima/repos","events_url":"https://api.github.com/users/vzima/events{/privacy}","received_events_url":"https://api.github.com/users/vzima/received_events","type":"User","site_admin":false},"body":"Don't use date.today() in here, mock the original today() call instead.\r\n\r\nMissing tests which starts/ends this year.","created_at":"2014-02-26T15:00:41Z","updated_at":"2014-02-26T15:00:41Z","html_url":"https://github.com/FUUK/fuuk/pull/16#discussion_r10082275","pull_request_url":"https://api.github.com/repos/FUUK/fuuk/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/FUUK/fuuk/pulls/comments/10082275"},"html":{"href":"https://github.com/FUUK/fuuk/pull/16#discussion_r10082275"},"pull_request":{"href":"https://api.github.com/repos/FUUK/fuuk/pulls/16"}}}}