{"action":"created","comment":{"url":"https://api.github.com/repos/jacquestardie/network-tools/pulls/comments/27444434","id":27444434,"diff_hunk":"@@ -0,0 +1,48 @@\n+# -*- coding: utf-8 -*-\n+\n+import pytest\n+import server\n+from client import client_server\n+\n+\n+def test_status_ok():\n+    '''Verify that 200 is passed when appropriate.'''\n+    request = '''GET /index.html HTTP/1.1\\r\\n\n+                Host: coolwebsite.com\\r\\n\n+                Content-Type: text/xml; charset=utf-8\\r\\n'''\n+    assert client_server(request).splitlines()[0].split()[1] == '200'\n+    assert client_server(request).splitlines()[0].split()[2] == 'OK'\n+\n+\n+def test_get_method():\n+    '''Verify that only GET methods are accepted.'''\n+    request = '''PUT /index.html HTTP/1.1\\r\\n\n+                Host: coolwebsite.com\\r\\n\n+                Content-Type: text/xml; charset=utf-8\\r\\n'''\n+    assert client_server(request).splitlines()[0].split()[1] == '405'\n+\n+\n+def test_http_protocol():\n+    '''Verify that only the HTTP1.1 protocol is supported.'''\n+    request = '''GET /index.html HTTP/1.0\\r\\n\n+                  Host: coolwebsite.com\\r\\n\n+                  Content-Type: text/xml; charset=utf-8\\r\\n'''\n+    assert client_server(request).splitlines()[0].split()[1] == '505'\n+\n+\n+def test_return_file():\n+    '''Verify that files can be returned.'''\n+    request = '''GET /a-web-page.html HTTP/1.1\\r\\n\n+                  Host: coolwebsite.com\\r\\n\n+                  Content-Type: text/xml; charset=utf-8\\r\\n'''\n+    response = client_server(request).splitlines()\n+    print response\n+    assert response[2] == 'Content-Length = 30'\n+\n+\n+def test_return_directory():\n+    '''Verify that directories can be returned.'''\n+    request = '''GET / HTTP/1.1\\r\\n\n+                  Host: coolwebsite.com\\r\\n\n+                  Content-Type: text/xml; charset=utf-8\\r\\n'''\n+    print request","path":"test_http.py","position":48,"original_position":48,"commit_id":"bec8b40d049a0f6d440dd4be7f62380017c78399","original_commit_id":"bec8b40d049a0f6d440dd4be7f62380017c78399","user":{"login":"cewing","id":417109,"avatar_url":"https://avatars.githubusercontent.com/u/417109?v=3","gravatar_id":"","url":"https://api.github.com/users/cewing","html_url":"https://github.com/cewing","followers_url":"https://api.github.com/users/cewing/followers","following_url":"https://api.github.com/users/cewing/following{/other_user}","gists_url":"https://api.github.com/users/cewing/gists{/gist_id}","starred_url":"https://api.github.com/users/cewing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cewing/subscriptions","organizations_url":"https://api.github.com/users/cewing/orgs","repos_url":"https://api.github.com/users/cewing/repos","events_url":"https://api.github.com/users/cewing/events{/privacy}","received_events_url":"https://api.github.com/users/cewing/received_events","type":"User","site_admin":false},"body":"you could write more *unit test* style tests if you'd factored `parse_request`, and `resolve_uri` properly above.  These sort of functional tests are good, but should not be the only tests you write.","created_at":"2015-03-31T00:21:47Z","updated_at":"2015-03-31T00:21:47Z","html_url":"https://github.com/jacquestardie/network-tools/pull/3#discussion_r27444434","pull_request_url":"https://api.github.com/repos/jacquestardie/network-tools/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/jacquestardie/network-tools/pulls/comments/27444434"},"html":{"href":"https://github.com/jacquestardie/network-tools/pull/3#discussion_r27444434"},"pull_request":{"href":"https://api.github.com/repos/jacquestardie/network-tools/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/jacquestardie/network-tools/pulls/3","id":32251691,"html_url":"https://github.com/jacquestardie/network-tools/pull/3","diff_url":"https://github.com/jacquestardie/network-tools/pull/3.diff","patch_url":"https://github.com/jacquestardie/network-tools/pull/3.patch","issue_url":"https://api.github.com/repos/jacquestardie/network-tools/issues/3","number":3,"state":"closed","locked":false,"title":"Http2","user":{"login":"jacquestardie","id":192642,"avatar_url":"https://avatars.githubusercontent.com/u/192642?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquestardie","html_url":"https://github.com/jacquestardie","followers_url":"https://api.github.com/users/jacquestardie/followers","following_url":"https://api.github.com/users/jacquestardie/following{/other_user}","gists_url":"https://api.github.com/users/jacquestardie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquestardie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquestardie/subscriptions","organizations_url":"https://api.github.com/users/jacquestardie/orgs","repos_url":"https://api.github.com/users/jacquestardie/repos","events_url":"https://api.github.com/users/jacquestardie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquestardie/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-30T18:08:25Z","updated_at":"2015-03-31T00:21:47Z","closed_at":"2015-03-30T18:41:06Z","merged_at":"2015-03-30T18:41:06Z","merge_commit_sha":"48dbc2815543c10b847daf99a1c76f5507672d35","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jacquestardie/network-tools/pulls/3/commits","review_comments_url":"https://api.github.com/repos/jacquestardie/network-tools/pulls/3/comments","review_comment_url":"https://api.github.com/repos/jacquestardie/network-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jacquestardie/network-tools/issues/3/comments","statuses_url":"https://api.github.com/repos/jacquestardie/network-tools/statuses/bec8b40d049a0f6d440dd4be7f62380017c78399","head":{"label":"jacquestardie:http2","ref":"http2","sha":"bec8b40d049a0f6d440dd4be7f62380017c78399","user":{"login":"jacquestardie","id":192642,"avatar_url":"https://avatars.githubusercontent.com/u/192642?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquestardie","html_url":"https://github.com/jacquestardie","followers_url":"https://api.github.com/users/jacquestardie/followers","following_url":"https://api.github.com/users/jacquestardie/following{/other_user}","gists_url":"https://api.github.com/users/jacquestardie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquestardie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquestardie/subscriptions","organizations_url":"https://api.github.com/users/jacquestardie/orgs","repos_url":"https://api.github.com/users/jacquestardie/repos","events_url":"https://api.github.com/users/jacquestardie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquestardie/received_events","type":"User","site_admin":false},"repo":{"id":30816897,"name":"network-tools","full_name":"jacquestardie/network-tools","owner":{"login":"jacquestardie","id":192642,"avatar_url":"https://avatars.githubusercontent.com/u/192642?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquestardie","html_url":"https://github.com/jacquestardie","followers_url":"https://api.github.com/users/jacquestardie/followers","following_url":"https://api.github.com/users/jacquestardie/following{/other_user}","gists_url":"https://api.github.com/users/jacquestardie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquestardie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquestardie/subscriptions","organizations_url":"https://api.github.com/users/jacquestardie/orgs","repos_url":"https://api.github.com/users/jacquestardie/repos","events_url":"https://api.github.com/users/jacquestardie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquestardie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jacquestardie/network-tools","description":"","fork":false,"url":"https://api.github.com/repos/jacquestardie/network-tools","forks_url":"https://api.github.com/repos/jacquestardie/network-tools/forks","keys_url":"https://api.github.com/repos/jacquestardie/network-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacquestardie/network-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacquestardie/network-tools/teams","hooks_url":"https://api.github.com/repos/jacquestardie/network-tools/hooks","issue_events_url":"https://api.github.com/repos/jacquestardie/network-tools/issues/events{/number}","events_url":"https://api.github.com/repos/jacquestardie/network-tools/events","assignees_url":"https://api.github.com/repos/jacquestardie/network-tools/assignees{/user}","branches_url":"https://api.github.com/repos/jacquestardie/network-tools/branches{/branch}","tags_url":"https://api.github.com/repos/jacquestardie/network-tools/tags","blobs_url":"https://api.github.com/repos/jacquestardie/network-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacquestardie/network-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacquestardie/network-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacquestardie/network-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacquestardie/network-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/jacquestardie/network-tools/languages","stargazers_url":"https://api.github.com/repos/jacquestardie/network-tools/stargazers","contributors_url":"https://api.github.com/repos/jacquestardie/network-tools/contributors","subscribers_url":"https://api.github.com/repos/jacquestardie/network-tools/subscribers","subscription_url":"https://api.github.com/repos/jacquestardie/network-tools/subscription","commits_url":"https://api.github.com/repos/jacquestardie/network-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacquestardie/network-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacquestardie/network-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacquestardie/network-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacquestardie/network-tools/contents/{+path}","compare_url":"https://api.github.com/repos/jacquestardie/network-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacquestardie/network-tools/merges","archive_url":"https://api.github.com/repos/jacquestardie/network-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacquestardie/network-tools/downloads","issues_url":"https://api.github.com/repos/jacquestardie/network-tools/issues{/number}","pulls_url":"https://api.github.com/repos/jacquestardie/network-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/jacquestardie/network-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/jacquestardie/network-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacquestardie/network-tools/labels{/name}","releases_url":"https://api.github.com/repos/jacquestardie/network-tools/releases{/id}","created_at":"2015-02-15T03:38:57Z","updated_at":"2015-03-30T18:41:06Z","pushed_at":"2015-03-30T18:41:06Z","git_url":"git://github.com/jacquestardie/network-tools.git","ssh_url":"git@github.com:jacquestardie/network-tools.git","clone_url":"https://github.com/jacquestardie/network-tools.git","svn_url":"https://github.com/jacquestardie/network-tools","homepage":null,"size":224,"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":"jacquestardie:master","ref":"master","sha":"8075d31c4ffd4eff2ba35aedebb13f6c597f17ae","user":{"login":"jacquestardie","id":192642,"avatar_url":"https://avatars.githubusercontent.com/u/192642?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquestardie","html_url":"https://github.com/jacquestardie","followers_url":"https://api.github.com/users/jacquestardie/followers","following_url":"https://api.github.com/users/jacquestardie/following{/other_user}","gists_url":"https://api.github.com/users/jacquestardie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquestardie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquestardie/subscriptions","organizations_url":"https://api.github.com/users/jacquestardie/orgs","repos_url":"https://api.github.com/users/jacquestardie/repos","events_url":"https://api.github.com/users/jacquestardie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquestardie/received_events","type":"User","site_admin":false},"repo":{"id":30816897,"name":"network-tools","full_name":"jacquestardie/network-tools","owner":{"login":"jacquestardie","id":192642,"avatar_url":"https://avatars.githubusercontent.com/u/192642?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquestardie","html_url":"https://github.com/jacquestardie","followers_url":"https://api.github.com/users/jacquestardie/followers","following_url":"https://api.github.com/users/jacquestardie/following{/other_user}","gists_url":"https://api.github.com/users/jacquestardie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquestardie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquestardie/subscriptions","organizations_url":"https://api.github.com/users/jacquestardie/orgs","repos_url":"https://api.github.com/users/jacquestardie/repos","events_url":"https://api.github.com/users/jacquestardie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquestardie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jacquestardie/network-tools","description":"","fork":false,"url":"https://api.github.com/repos/jacquestardie/network-tools","forks_url":"https://api.github.com/repos/jacquestardie/network-tools/forks","keys_url":"https://api.github.com/repos/jacquestardie/network-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacquestardie/network-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacquestardie/network-tools/teams","hooks_url":"https://api.github.com/repos/jacquestardie/network-tools/hooks","issue_events_url":"https://api.github.com/repos/jacquestardie/network-tools/issues/events{/number}","events_url":"https://api.github.com/repos/jacquestardie/network-tools/events","assignees_url":"https://api.github.com/repos/jacquestardie/network-tools/assignees{/user}","branches_url":"https://api.github.com/repos/jacquestardie/network-tools/branches{/branch}","tags_url":"https://api.github.com/repos/jacquestardie/network-tools/tags","blobs_url":"https://api.github.com/repos/jacquestardie/network-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacquestardie/network-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacquestardie/network-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacquestardie/network-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacquestardie/network-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/jacquestardie/network-tools/languages","stargazers_url":"https://api.github.com/repos/jacquestardie/network-tools/stargazers","contributors_url":"https://api.github.com/repos/jacquestardie/network-tools/contributors","subscribers_url":"https://api.github.com/repos/jacquestardie/network-tools/subscribers","subscription_url":"https://api.github.com/repos/jacquestardie/network-tools/subscription","commits_url":"https://api.github.com/repos/jacquestardie/network-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacquestardie/network-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacquestardie/network-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacquestardie/network-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacquestardie/network-tools/contents/{+path}","compare_url":"https://api.github.com/repos/jacquestardie/network-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacquestardie/network-tools/merges","archive_url":"https://api.github.com/repos/jacquestardie/network-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacquestardie/network-tools/downloads","issues_url":"https://api.github.com/repos/jacquestardie/network-tools/issues{/number}","pulls_url":"https://api.github.com/repos/jacquestardie/network-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/jacquestardie/network-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/jacquestardie/network-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacquestardie/network-tools/labels{/name}","releases_url":"https://api.github.com/repos/jacquestardie/network-tools/releases{/id}","created_at":"2015-02-15T03:38:57Z","updated_at":"2015-03-30T18:41:06Z","pushed_at":"2015-03-30T18:41:06Z","git_url":"git://github.com/jacquestardie/network-tools.git","ssh_url":"git@github.com:jacquestardie/network-tools.git","clone_url":"https://github.com/jacquestardie/network-tools.git","svn_url":"https://github.com/jacquestardie/network-tools","homepage":null,"size":224,"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/jacquestardie/network-tools/pulls/3"},"html":{"href":"https://github.com/jacquestardie/network-tools/pull/3"},"issue":{"href":"https://api.github.com/repos/jacquestardie/network-tools/issues/3"},"comments":{"href":"https://api.github.com/repos/jacquestardie/network-tools/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/jacquestardie/network-tools/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/jacquestardie/network-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jacquestardie/network-tools/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/jacquestardie/network-tools/statuses/bec8b40d049a0f6d440dd4be7f62380017c78399"}}}}