{"action":"created","comment":{"url":"https://api.github.com/repos/incuna/incuna-pagination/pulls/comments/48741296","id":48741296,"diff_hunk":"@@ -0,0 +1,38 @@\n+from django.http import QueryDict\n+\n+from .utils import RequestTestCase\n+from .. import querystrings\n+\n+\n+class TestQuerystringUpdate(RequestTestCase):\n+    def setUp(self):\n+        \"\"\"Create a request and put some GET args in it.\"\"\"\n+        self.request = self.create_request()\n+        self.request.GET = QueryDict('page=3&q=search_term')\n+\n+    def test_unchanged_querystring(self):\n+        \"\"\"Test that the method returns an unchanged request.GET if kwargs is empty.\"\"\"\n+        querystring = querystrings.querystring_update(self.request)\n+\n+        # Re-parse the result into a dict because the query arguments don't appear in\n+        # a predictable order.\n+        new_querydict = QueryDict(querystring).dict()\n+        expected = {\n+            'page': '3',\n+            'q': 'search_term',\n+        }\n+        self.assertDictEqual(new_querydict, expected)\n+\n+    def test_querystring_update(self):\n+        \"\"\"Test that individual GET arguments are updated or preserved correctly.\"\"\"\n+        search_term = 'a_different_search_term'\n+        querystring = querystrings.querystring_update(self.request, q=search_term)\n+\n+        # Re-parse the result into a dict because the query arguments don't appear in\n+        # a predictable order.\n+        new_querydict = QueryDict(querystring).dict()\n+        expected = {\n+            'page': '3',\n+            'q': search_term,\n+        }\n+        self.assertDictEqual(new_querydict, expected)","path":"pagination/tests/test_querystrings.py","position":38,"original_position":38,"commit_id":"686807508cfe402cd6a7809c0e6afbc1ab88d0d2","original_commit_id":"686807508cfe402cd6a7809c0e6afbc1ab88d0d2","user":{"login":"Ian-Foote","id":1843202,"avatar_url":"https://avatars.githubusercontent.com/u/1843202?v=3","gravatar_id":"","url":"https://api.github.com/users/Ian-Foote","html_url":"https://github.com/Ian-Foote","followers_url":"https://api.github.com/users/Ian-Foote/followers","following_url":"https://api.github.com/users/Ian-Foote/following{/other_user}","gists_url":"https://api.github.com/users/Ian-Foote/gists{/gist_id}","starred_url":"https://api.github.com/users/Ian-Foote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ian-Foote/subscriptions","organizations_url":"https://api.github.com/users/Ian-Foote/orgs","repos_url":"https://api.github.com/users/Ian-Foote/repos","events_url":"https://api.github.com/users/Ian-Foote/events{/privacy}","received_events_url":"https://api.github.com/users/Ian-Foote/received_events","type":"User","site_admin":false},"body":"I mean that a generator isn't a `Sequence`, so it doesn't make sense to compare it to a `tuple` whether with `assertEqual` or `assertSequenceEqual`.","created_at":"2016-01-04T15:29:13Z","updated_at":"2016-01-04T15:29:13Z","html_url":"https://github.com/incuna/incuna-pagination/pull/1#discussion_r48741296","pull_request_url":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/incuna/incuna-pagination/pulls/comments/48741296"},"html":{"href":"https://github.com/incuna/incuna-pagination/pull/1#discussion_r48741296"},"pull_request":{"href":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1","id":54723772,"html_url":"https://github.com/incuna/incuna-pagination/pull/1","diff_url":"https://github.com/incuna/incuna-pagination/pull/1.diff","patch_url":"https://github.com/incuna/incuna-pagination/pull/1.patch","issue_url":"https://api.github.com/repos/incuna/incuna-pagination/issues/1","number":1,"state":"closed","locked":false,"title":"CREATE ALL THE THINGS","user":{"login":"adam-thomas","id":6973481,"avatar_url":"https://avatars.githubusercontent.com/u/6973481?v=3","gravatar_id":"","url":"https://api.github.com/users/adam-thomas","html_url":"https://github.com/adam-thomas","followers_url":"https://api.github.com/users/adam-thomas/followers","following_url":"https://api.github.com/users/adam-thomas/following{/other_user}","gists_url":"https://api.github.com/users/adam-thomas/gists{/gist_id}","starred_url":"https://api.github.com/users/adam-thomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adam-thomas/subscriptions","organizations_url":"https://api.github.com/users/adam-thomas/orgs","repos_url":"https://api.github.com/users/adam-thomas/repos","events_url":"https://api.github.com/users/adam-thomas/events{/privacy}","received_events_url":"https://api.github.com/users/adam-thomas/received_events","type":"User","site_admin":false},"body":"@incuna/backend New library for pagination, so we can use it elsewhere.  I wanted to pull this into `incuna-groups` and figured it'd be best put into its own library so everyone can use it.\n\nI've used the `test_project` setup I created for `incuna-groups` since it is:\n- easy to copy and paste\n- very flexible/extensible (e.g. if we need migrations in future, more complex test setup, etc)\n- consistent with other repos we're going to be creating in the future (iirc)\n\nSince nobody's around and I have to do work, I'm going to merge this as soon as Travis is happy, but feel free to comment/open issues/berate me after the fact if you have opinions, and we can improve things later on :)","created_at":"2015-12-29T12:42:12Z","updated_at":"2016-01-04T15:29:13Z","closed_at":"2015-12-29T15:09:31Z","merged_at":"2015-12-29T15:09:31Z","merge_commit_sha":"0ee7b3f610bb1425e1bff198958fe353ef100408","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1/commits","review_comments_url":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1/comments","review_comment_url":"https://api.github.com/repos/incuna/incuna-pagination/pulls/comments{/number}","comments_url":"https://api.github.com/repos/incuna/incuna-pagination/issues/1/comments","statuses_url":"https://api.github.com/repos/incuna/incuna-pagination/statuses/686807508cfe402cd6a7809c0e6afbc1ab88d0d2","head":{"label":"incuna:__init__","ref":"__init__","sha":"686807508cfe402cd6a7809c0e6afbc1ab88d0d2","user":{"login":"incuna","id":55510,"avatar_url":"https://avatars.githubusercontent.com/u/55510?v=3","gravatar_id":"","url":"https://api.github.com/users/incuna","html_url":"https://github.com/incuna","followers_url":"https://api.github.com/users/incuna/followers","following_url":"https://api.github.com/users/incuna/following{/other_user}","gists_url":"https://api.github.com/users/incuna/gists{/gist_id}","starred_url":"https://api.github.com/users/incuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/incuna/subscriptions","organizations_url":"https://api.github.com/users/incuna/orgs","repos_url":"https://api.github.com/users/incuna/repos","events_url":"https://api.github.com/users/incuna/events{/privacy}","received_events_url":"https://api.github.com/users/incuna/received_events","type":"Organization","site_admin":false},"repo":{"id":48746176,"name":"incuna-pagination","full_name":"incuna/incuna-pagination","owner":{"login":"incuna","id":55510,"avatar_url":"https://avatars.githubusercontent.com/u/55510?v=3","gravatar_id":"","url":"https://api.github.com/users/incuna","html_url":"https://github.com/incuna","followers_url":"https://api.github.com/users/incuna/followers","following_url":"https://api.github.com/users/incuna/following{/other_user}","gists_url":"https://api.github.com/users/incuna/gists{/gist_id}","starred_url":"https://api.github.com/users/incuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/incuna/subscriptions","organizations_url":"https://api.github.com/users/incuna/orgs","repos_url":"https://api.github.com/users/incuna/repos","events_url":"https://api.github.com/users/incuna/events{/privacy}","received_events_url":"https://api.github.com/users/incuna/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/incuna/incuna-pagination","description":"Templates and tags for easy display of paginated data.","fork":false,"url":"https://api.github.com/repos/incuna/incuna-pagination","forks_url":"https://api.github.com/repos/incuna/incuna-pagination/forks","keys_url":"https://api.github.com/repos/incuna/incuna-pagination/keys{/key_id}","collaborators_url":"https://api.github.com/repos/incuna/incuna-pagination/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/incuna/incuna-pagination/teams","hooks_url":"https://api.github.com/repos/incuna/incuna-pagination/hooks","issue_events_url":"https://api.github.com/repos/incuna/incuna-pagination/issues/events{/number}","events_url":"https://api.github.com/repos/incuna/incuna-pagination/events","assignees_url":"https://api.github.com/repos/incuna/incuna-pagination/assignees{/user}","branches_url":"https://api.github.com/repos/incuna/incuna-pagination/branches{/branch}","tags_url":"https://api.github.com/repos/incuna/incuna-pagination/tags","blobs_url":"https://api.github.com/repos/incuna/incuna-pagination/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/incuna/incuna-pagination/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/incuna/incuna-pagination/git/refs{/sha}","trees_url":"https://api.github.com/repos/incuna/incuna-pagination/git/trees{/sha}","statuses_url":"https://api.github.com/repos/incuna/incuna-pagination/statuses/{sha}","languages_url":"https://api.github.com/repos/incuna/incuna-pagination/languages","stargazers_url":"https://api.github.com/repos/incuna/incuna-pagination/stargazers","contributors_url":"https://api.github.com/repos/incuna/incuna-pagination/contributors","subscribers_url":"https://api.github.com/repos/incuna/incuna-pagination/subscribers","subscription_url":"https://api.github.com/repos/incuna/incuna-pagination/subscription","commits_url":"https://api.github.com/repos/incuna/incuna-pagination/commits{/sha}","git_commits_url":"https://api.github.com/repos/incuna/incuna-pagination/git/commits{/sha}","comments_url":"https://api.github.com/repos/incuna/incuna-pagination/comments{/number}","issue_comment_url":"https://api.github.com/repos/incuna/incuna-pagination/issues/comments{/number}","contents_url":"https://api.github.com/repos/incuna/incuna-pagination/contents/{+path}","compare_url":"https://api.github.com/repos/incuna/incuna-pagination/compare/{base}...{head}","merges_url":"https://api.github.com/repos/incuna/incuna-pagination/merges","archive_url":"https://api.github.com/repos/incuna/incuna-pagination/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/incuna/incuna-pagination/downloads","issues_url":"https://api.github.com/repos/incuna/incuna-pagination/issues{/number}","pulls_url":"https://api.github.com/repos/incuna/incuna-pagination/pulls{/number}","milestones_url":"https://api.github.com/repos/incuna/incuna-pagination/milestones{/number}","notifications_url":"https://api.github.com/repos/incuna/incuna-pagination/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/incuna/incuna-pagination/labels{/name}","releases_url":"https://api.github.com/repos/incuna/incuna-pagination/releases{/id}","created_at":"2015-12-29T12:17:15Z","updated_at":"2015-12-29T15:09:32Z","pushed_at":"2016-01-04T13:43:34Z","git_url":"git://github.com/incuna/incuna-pagination.git","ssh_url":"git@github.com:incuna/incuna-pagination.git","clone_url":"https://github.com/incuna/incuna-pagination.git","svn_url":"https://github.com/incuna/incuna-pagination","homepage":null,"size":15,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"incuna:master","ref":"master","sha":"122e91c78017932a6f735af01683a99887631f74","user":{"login":"incuna","id":55510,"avatar_url":"https://avatars.githubusercontent.com/u/55510?v=3","gravatar_id":"","url":"https://api.github.com/users/incuna","html_url":"https://github.com/incuna","followers_url":"https://api.github.com/users/incuna/followers","following_url":"https://api.github.com/users/incuna/following{/other_user}","gists_url":"https://api.github.com/users/incuna/gists{/gist_id}","starred_url":"https://api.github.com/users/incuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/incuna/subscriptions","organizations_url":"https://api.github.com/users/incuna/orgs","repos_url":"https://api.github.com/users/incuna/repos","events_url":"https://api.github.com/users/incuna/events{/privacy}","received_events_url":"https://api.github.com/users/incuna/received_events","type":"Organization","site_admin":false},"repo":{"id":48746176,"name":"incuna-pagination","full_name":"incuna/incuna-pagination","owner":{"login":"incuna","id":55510,"avatar_url":"https://avatars.githubusercontent.com/u/55510?v=3","gravatar_id":"","url":"https://api.github.com/users/incuna","html_url":"https://github.com/incuna","followers_url":"https://api.github.com/users/incuna/followers","following_url":"https://api.github.com/users/incuna/following{/other_user}","gists_url":"https://api.github.com/users/incuna/gists{/gist_id}","starred_url":"https://api.github.com/users/incuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/incuna/subscriptions","organizations_url":"https://api.github.com/users/incuna/orgs","repos_url":"https://api.github.com/users/incuna/repos","events_url":"https://api.github.com/users/incuna/events{/privacy}","received_events_url":"https://api.github.com/users/incuna/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/incuna/incuna-pagination","description":"Templates and tags for easy display of paginated data.","fork":false,"url":"https://api.github.com/repos/incuna/incuna-pagination","forks_url":"https://api.github.com/repos/incuna/incuna-pagination/forks","keys_url":"https://api.github.com/repos/incuna/incuna-pagination/keys{/key_id}","collaborators_url":"https://api.github.com/repos/incuna/incuna-pagination/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/incuna/incuna-pagination/teams","hooks_url":"https://api.github.com/repos/incuna/incuna-pagination/hooks","issue_events_url":"https://api.github.com/repos/incuna/incuna-pagination/issues/events{/number}","events_url":"https://api.github.com/repos/incuna/incuna-pagination/events","assignees_url":"https://api.github.com/repos/incuna/incuna-pagination/assignees{/user}","branches_url":"https://api.github.com/repos/incuna/incuna-pagination/branches{/branch}","tags_url":"https://api.github.com/repos/incuna/incuna-pagination/tags","blobs_url":"https://api.github.com/repos/incuna/incuna-pagination/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/incuna/incuna-pagination/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/incuna/incuna-pagination/git/refs{/sha}","trees_url":"https://api.github.com/repos/incuna/incuna-pagination/git/trees{/sha}","statuses_url":"https://api.github.com/repos/incuna/incuna-pagination/statuses/{sha}","languages_url":"https://api.github.com/repos/incuna/incuna-pagination/languages","stargazers_url":"https://api.github.com/repos/incuna/incuna-pagination/stargazers","contributors_url":"https://api.github.com/repos/incuna/incuna-pagination/contributors","subscribers_url":"https://api.github.com/repos/incuna/incuna-pagination/subscribers","subscription_url":"https://api.github.com/repos/incuna/incuna-pagination/subscription","commits_url":"https://api.github.com/repos/incuna/incuna-pagination/commits{/sha}","git_commits_url":"https://api.github.com/repos/incuna/incuna-pagination/git/commits{/sha}","comments_url":"https://api.github.com/repos/incuna/incuna-pagination/comments{/number}","issue_comment_url":"https://api.github.com/repos/incuna/incuna-pagination/issues/comments{/number}","contents_url":"https://api.github.com/repos/incuna/incuna-pagination/contents/{+path}","compare_url":"https://api.github.com/repos/incuna/incuna-pagination/compare/{base}...{head}","merges_url":"https://api.github.com/repos/incuna/incuna-pagination/merges","archive_url":"https://api.github.com/repos/incuna/incuna-pagination/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/incuna/incuna-pagination/downloads","issues_url":"https://api.github.com/repos/incuna/incuna-pagination/issues{/number}","pulls_url":"https://api.github.com/repos/incuna/incuna-pagination/pulls{/number}","milestones_url":"https://api.github.com/repos/incuna/incuna-pagination/milestones{/number}","notifications_url":"https://api.github.com/repos/incuna/incuna-pagination/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/incuna/incuna-pagination/labels{/name}","releases_url":"https://api.github.com/repos/incuna/incuna-pagination/releases{/id}","created_at":"2015-12-29T12:17:15Z","updated_at":"2015-12-29T15:09:32Z","pushed_at":"2016-01-04T13:43:34Z","git_url":"git://github.com/incuna/incuna-pagination.git","ssh_url":"git@github.com:incuna/incuna-pagination.git","clone_url":"https://github.com/incuna/incuna-pagination.git","svn_url":"https://github.com/incuna/incuna-pagination","homepage":null,"size":15,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1"},"html":{"href":"https://github.com/incuna/incuna-pagination/pull/1"},"issue":{"href":"https://api.github.com/repos/incuna/incuna-pagination/issues/1"},"comments":{"href":"https://api.github.com/repos/incuna/incuna-pagination/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/incuna/incuna-pagination/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/incuna/incuna-pagination/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/incuna/incuna-pagination/statuses/686807508cfe402cd6a7809c0e6afbc1ab88d0d2"}}}}