{"action":"created","comment":{"url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/comments/53498040","id":53498040,"diff_hunk":"@@ -0,0 +1,700 @@\n+import re\n+import json\n+from string import digits, uppercase, capwords\n+\n+from django import http\n+from django.conf import settings\n+\n+import pytest\n+\n+from nomination import url_handler, models\n+import factories\n+\n+\n+pytestmark = pytest.mark.django_db\n+alnum_list = sorted(digits + uppercase)\n+\n+\n+def test_alphabetical_browse():\n+    surts = {\n+        'A': ('http://(org,alarm,)', 'http://(org,a'),\n+        'C': ('http://(org,charlie,)', 'http://(org,c'),\n+        '1': ('http://(org,123,)', 'http://(org,1')\n+    }\n+    project = factories.ProjectFactory()\n+    # Create the surts we're expecting to see represented in the returned dict.\n+    [factories.SURTFactory(url_project=project, value=surts[key][0]) for key in iter(surts)]\n+    expected = {'org': [(x, surts[x][1] if surts.get(x) else None) for x in alnum_list]}\n+    # Create another unrelated SURT to make sure we aren't grabbing everything.\n+    factories.SURTFactory()\n+    returned = url_handler.alphabetical_browse(project)\n+\n+    assert returned == expected\n+\n+\n+@pytest.mark.parametrize('surt, expected', [\n+    ('http://(,)', {}),\n+    ('http://(org,)', {'org': [(x, None) for x in alnum_list]})\n+])\n+def test_alphabetical_browse_domains_not_found(surt, expected):\n+    project = factories.ProjectFactory()\n+    factories.SURTFactory(url_project=project, value=surt)\n+    returned = url_handler.alphabetical_browse(project)\n+\n+    assert returned == expected\n+\n+\n+def test_alphabetical_browse_fake_project():\n+    project = 'not a real project'\n+    with pytest.raises(http.Http404):\n+        url_handler.alphabetical_browse(project)\n+\n+\n+def test_get_metadata():\n+    project = factories.ProjectFactory()\n+    vals = [x.metadata for x in factories.MetadataValuesFactory.create_batch(3)]\n+    metadata = [factories.ProjectMetadataFactory(project=project, metadata=x) for x in vals]\n+    expected = [(x, [models.Metadata_Values.objects.get(metadata=x).value]) for x in metadata]\n+    returned = url_handler.get_metadata(project)\n+\n+    for each in returned:\n+        assert str(each) in str(expected)","path":"tests/test_url_handler.py","position":61,"original_position":61,"commit_id":"aaa07e7bea48ce4af02f66b6ec4aec249372770e","original_commit_id":"aaa07e7bea48ce4af02f66b6ec4aec249372770e","user":{"login":"ldko","id":6740390,"avatar_url":"https://avatars.githubusercontent.com/u/6740390?v=3","gravatar_id":"","url":"https://api.github.com/users/ldko","html_url":"https://github.com/ldko","followers_url":"https://api.github.com/users/ldko/followers","following_url":"https://api.github.com/users/ldko/following{/other_user}","gists_url":"https://api.github.com/users/ldko/gists{/gist_id}","starred_url":"https://api.github.com/users/ldko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldko/subscriptions","organizations_url":"https://api.github.com/users/ldko/orgs","repos_url":"https://api.github.com/users/ldko/repos","events_url":"https://api.github.com/users/ldko/events{/privacy}","received_events_url":"https://api.github.com/users/ldko/received_events","type":"User","site_admin":false},"body":"I find having `returned` in the variable name informative, but perhaps if it were more specific like call it `returned_tuple_list` and `expected_tuple_list`.","created_at":"2016-02-19T18:30:28Z","updated_at":"2016-02-19T18:30:28Z","html_url":"https://github.com/unt-libraries/django-nomination/pull/20#discussion_r53498040","pull_request_url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/comments/53498040"},"html":{"href":"https://github.com/unt-libraries/django-nomination/pull/20#discussion_r53498040"},"pull_request":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20","id":57544980,"html_url":"https://github.com/unt-libraries/django-nomination/pull/20","diff_url":"https://github.com/unt-libraries/django-nomination/pull/20.diff","patch_url":"https://github.com/unt-libraries/django-nomination/pull/20.patch","issue_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues/20","number":20,"state":"open","locked":false,"title":"Test url handlers","user":{"login":"somexpert","id":5580991,"avatar_url":"https://avatars.githubusercontent.com/u/5580991?v=3","gravatar_id":"","url":"https://api.github.com/users/somexpert","html_url":"https://github.com/somexpert","followers_url":"https://api.github.com/users/somexpert/followers","following_url":"https://api.github.com/users/somexpert/following{/other_user}","gists_url":"https://api.github.com/users/somexpert/gists{/gist_id}","starred_url":"https://api.github.com/users/somexpert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somexpert/subscriptions","organizations_url":"https://api.github.com/users/somexpert/orgs","repos_url":"https://api.github.com/users/somexpert/repos","events_url":"https://api.github.com/users/somexpert/events{/privacy}","received_events_url":"https://api.github.com/users/somexpert/received_events","type":"User","site_admin":false},"body":"Adds test for url_handlers.py. Fixes #16.","created_at":"2016-01-28T18:33:59Z","updated_at":"2016-02-19T18:30:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65cf7186323cc2768c12d73b3743901a9c7d6c49","assignee":{"login":"somexpert","id":5580991,"avatar_url":"https://avatars.githubusercontent.com/u/5580991?v=3","gravatar_id":"","url":"https://api.github.com/users/somexpert","html_url":"https://github.com/somexpert","followers_url":"https://api.github.com/users/somexpert/followers","following_url":"https://api.github.com/users/somexpert/following{/other_user}","gists_url":"https://api.github.com/users/somexpert/gists{/gist_id}","starred_url":"https://api.github.com/users/somexpert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somexpert/subscriptions","organizations_url":"https://api.github.com/users/somexpert/orgs","repos_url":"https://api.github.com/users/somexpert/repos","events_url":"https://api.github.com/users/somexpert/events{/privacy}","received_events_url":"https://api.github.com/users/somexpert/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/unt-libraries/django-nomination/milestones/1","html_url":"https://github.com/unt-libraries/django-nomination/milestones/Test%20coverage","labels_url":"https://api.github.com/repos/unt-libraries/django-nomination/milestones/1/labels","id":1535061,"number":1,"title":"Test coverage","description":"Add tests for all the major components of django-nomination.","creator":{"login":"somexpert","id":5580991,"avatar_url":"https://avatars.githubusercontent.com/u/5580991?v=3","gravatar_id":"","url":"https://api.github.com/users/somexpert","html_url":"https://github.com/somexpert","followers_url":"https://api.github.com/users/somexpert/followers","following_url":"https://api.github.com/users/somexpert/following{/other_user}","gists_url":"https://api.github.com/users/somexpert/gists{/gist_id}","starred_url":"https://api.github.com/users/somexpert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somexpert/subscriptions","organizations_url":"https://api.github.com/users/somexpert/orgs","repos_url":"https://api.github.com/users/somexpert/repos","events_url":"https://api.github.com/users/somexpert/events{/privacy}","received_events_url":"https://api.github.com/users/somexpert/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":7,"state":"open","created_at":"2016-01-22T17:15:42Z","updated_at":"2016-02-10T17:38:04Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20/commits","review_comments_url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20/comments","review_comment_url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues/20/comments","statuses_url":"https://api.github.com/repos/unt-libraries/django-nomination/statuses/aaa07e7bea48ce4af02f66b6ec4aec249372770e","head":{"label":"unt-libraries:test-url-handlers","ref":"test-url-handlers","sha":"aaa07e7bea48ce4af02f66b6ec4aec249372770e","user":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"repo":{"id":50130906,"name":"django-nomination","full_name":"unt-libraries/django-nomination","owner":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unt-libraries/django-nomination","description":"A Django application for nominating URLs by project.","fork":false,"url":"https://api.github.com/repos/unt-libraries/django-nomination","forks_url":"https://api.github.com/repos/unt-libraries/django-nomination/forks","keys_url":"https://api.github.com/repos/unt-libraries/django-nomination/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unt-libraries/django-nomination/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unt-libraries/django-nomination/teams","hooks_url":"https://api.github.com/repos/unt-libraries/django-nomination/hooks","issue_events_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues/events{/number}","events_url":"https://api.github.com/repos/unt-libraries/django-nomination/events","assignees_url":"https://api.github.com/repos/unt-libraries/django-nomination/assignees{/user}","branches_url":"https://api.github.com/repos/unt-libraries/django-nomination/branches{/branch}","tags_url":"https://api.github.com/repos/unt-libraries/django-nomination/tags","blobs_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/refs{/sha}","trees_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unt-libraries/django-nomination/statuses/{sha}","languages_url":"https://api.github.com/repos/unt-libraries/django-nomination/languages","stargazers_url":"https://api.github.com/repos/unt-libraries/django-nomination/stargazers","contributors_url":"https://api.github.com/repos/unt-libraries/django-nomination/contributors","subscribers_url":"https://api.github.com/repos/unt-libraries/django-nomination/subscribers","subscription_url":"https://api.github.com/repos/unt-libraries/django-nomination/subscription","commits_url":"https://api.github.com/repos/unt-libraries/django-nomination/commits{/sha}","git_commits_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/commits{/sha}","comments_url":"https://api.github.com/repos/unt-libraries/django-nomination/comments{/number}","issue_comment_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues/comments{/number}","contents_url":"https://api.github.com/repos/unt-libraries/django-nomination/contents/{+path}","compare_url":"https://api.github.com/repos/unt-libraries/django-nomination/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unt-libraries/django-nomination/merges","archive_url":"https://api.github.com/repos/unt-libraries/django-nomination/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unt-libraries/django-nomination/downloads","issues_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues{/number}","pulls_url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls{/number}","milestones_url":"https://api.github.com/repos/unt-libraries/django-nomination/milestones{/number}","notifications_url":"https://api.github.com/repos/unt-libraries/django-nomination/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unt-libraries/django-nomination/labels{/name}","releases_url":"https://api.github.com/repos/unt-libraries/django-nomination/releases{/id}","deployments_url":"https://api.github.com/repos/unt-libraries/django-nomination/deployments","created_at":"2016-01-21T19:22:05Z","updated_at":"2016-01-21T19:24:52Z","pushed_at":"2016-02-15T20:59:48Z","git_url":"git://github.com/unt-libraries/django-nomination.git","ssh_url":"git@github.com:unt-libraries/django-nomination.git","clone_url":"https://github.com/unt-libraries/django-nomination.git","svn_url":"https://github.com/unt-libraries/django-nomination","homepage":null,"size":334,"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":30,"forks":0,"open_issues":30,"watchers":0,"default_branch":"master"}},"base":{"label":"unt-libraries:master","ref":"master","sha":"b800a16cec5ee56833a185bc9e5477a24f2cc953","user":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"repo":{"id":50130906,"name":"django-nomination","full_name":"unt-libraries/django-nomination","owner":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unt-libraries/django-nomination","description":"A Django application for nominating URLs by project.","fork":false,"url":"https://api.github.com/repos/unt-libraries/django-nomination","forks_url":"https://api.github.com/repos/unt-libraries/django-nomination/forks","keys_url":"https://api.github.com/repos/unt-libraries/django-nomination/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unt-libraries/django-nomination/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unt-libraries/django-nomination/teams","hooks_url":"https://api.github.com/repos/unt-libraries/django-nomination/hooks","issue_events_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues/events{/number}","events_url":"https://api.github.com/repos/unt-libraries/django-nomination/events","assignees_url":"https://api.github.com/repos/unt-libraries/django-nomination/assignees{/user}","branches_url":"https://api.github.com/repos/unt-libraries/django-nomination/branches{/branch}","tags_url":"https://api.github.com/repos/unt-libraries/django-nomination/tags","blobs_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/refs{/sha}","trees_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unt-libraries/django-nomination/statuses/{sha}","languages_url":"https://api.github.com/repos/unt-libraries/django-nomination/languages","stargazers_url":"https://api.github.com/repos/unt-libraries/django-nomination/stargazers","contributors_url":"https://api.github.com/repos/unt-libraries/django-nomination/contributors","subscribers_url":"https://api.github.com/repos/unt-libraries/django-nomination/subscribers","subscription_url":"https://api.github.com/repos/unt-libraries/django-nomination/subscription","commits_url":"https://api.github.com/repos/unt-libraries/django-nomination/commits{/sha}","git_commits_url":"https://api.github.com/repos/unt-libraries/django-nomination/git/commits{/sha}","comments_url":"https://api.github.com/repos/unt-libraries/django-nomination/comments{/number}","issue_comment_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues/comments{/number}","contents_url":"https://api.github.com/repos/unt-libraries/django-nomination/contents/{+path}","compare_url":"https://api.github.com/repos/unt-libraries/django-nomination/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unt-libraries/django-nomination/merges","archive_url":"https://api.github.com/repos/unt-libraries/django-nomination/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unt-libraries/django-nomination/downloads","issues_url":"https://api.github.com/repos/unt-libraries/django-nomination/issues{/number}","pulls_url":"https://api.github.com/repos/unt-libraries/django-nomination/pulls{/number}","milestones_url":"https://api.github.com/repos/unt-libraries/django-nomination/milestones{/number}","notifications_url":"https://api.github.com/repos/unt-libraries/django-nomination/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unt-libraries/django-nomination/labels{/name}","releases_url":"https://api.github.com/repos/unt-libraries/django-nomination/releases{/id}","deployments_url":"https://api.github.com/repos/unt-libraries/django-nomination/deployments","created_at":"2016-01-21T19:22:05Z","updated_at":"2016-01-21T19:24:52Z","pushed_at":"2016-02-15T20:59:48Z","git_url":"git://github.com/unt-libraries/django-nomination.git","ssh_url":"git@github.com:unt-libraries/django-nomination.git","clone_url":"https://github.com/unt-libraries/django-nomination.git","svn_url":"https://github.com/unt-libraries/django-nomination","homepage":null,"size":334,"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":30,"forks":0,"open_issues":30,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20"},"html":{"href":"https://github.com/unt-libraries/django-nomination/pull/20"},"issue":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/issues/20"},"comments":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/unt-libraries/django-nomination/statuses/aaa07e7bea48ce4af02f66b6ec4aec249372770e"}}}}