{"action":"created","comment":{"url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/comments/24784735","id":24784735,"diff_hunk":"@@ -1,15 +1,45 @@\n import echo_client\n \n \n-def test_basic_entry():\n-    assert echo_client.start_client(\"Hello\") == \"Received message: Hello\"\n+def test_HTTP_bad_response_error():\n+    msg = echo_client.start_client(\"\"\"\n+            Hello!\n+            \"\"\")\n+    error_response = \"HTTP/1.1 400 ERROR\\r\\n\"\n+    headers = \"Content-Type: text/plain\\r\\n\"\n+    body = \"ERROR 400, BAD REQUEST\\r\\n\"\n+    response = \"{}{}{}\".format(error_response, headers, body)\n+    assert msg == response\n \n \n-def test_long_entry():\n-    msg = echo_client.start_client(\"This message is longer than buffer\")\n-    assert msg == \"Received message: This message is longer than buffer\"\n+def test_HTTP_okay():\n+    msg = echo_client.start_client(\"\"\"\n+            GET /fake/uri HTTP/1.1\\r\\nHost: localhost:50001\\r\\n\n+            \"\"\")\n+    okay_response = \"HTTP/1.1 200 OK\\r\\n\"\n+    headers = \"Content-Type: text/plain\\r\\n\"\n+    body = \"you requested: /fake/uri\"\n+    response = \"{}{}{}\\r\\n\".format(okay_response, headers, body)\n+    assert msg == response\n \n \n-def test_unicode_entry():\n-    msg = echo_client.start_client(unicode('Hello'))\n-    assert msg == \"Received message: Hello\"\n+def test_HTTP_method_error():\n+    msg = echo_client.start_client(\"\"\"\n+            POST /path/to/index.html HTTP/1.1\\r\\nHost: localhost:50001\\r\\n\n+            \"\"\")\n+    error_response = \"HTTP/1.1 405 ERROR\\r\\n\"\n+    headers = \"Content-Type: text/plain\\r\\n\"\n+    body = \"ERROR 405, POST METHOD NOT ALLOWED\\r\\n\"\n+    response = \"{}{}{}\".format(error_response, headers, body)\n+    assert msg == response\n+\n+\n+def test_HTTP_version_error():\n+    msg = echo_client.start_client(\"\"\"\n+            GET /path/to/index.html HTTP/1.0\\r\\nHost: localhost:50001\\r\\n\n+            \"\"\")\n+    error_response = \"HTTP/1.1 505 ERROR\\r\\n\"\n+    headers = \"Content-Type: text/plain\\r\\n\"\n+    body = \"ERROR 505, HTTP/1.0 NOT SUPPORTED\\r\\n\"\n+    response = \"{}{}{}\".format(error_response, headers, body)\n+    assert msg == response","path":"test_client.py","position":53,"original_position":53,"commit_id":"97e31562b0795406d35925ec4897a8f6b6f78935","original_commit_id":"97e31562b0795406d35925ec4897a8f6b6f78935","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 have written functional tests that address the server as a black box.  That's a valid testing strategy, but it doesn't get at whether individual functions are working properly.  You should also have unit tests that verify that when you call (for example) the `parse_request` method, you get a URI or you get errors if the method or protocol are wrong.\r\n","created_at":"2015-02-17T00:25:39Z","updated_at":"2015-02-17T00:25:39Z","html_url":"https://github.com/robertwhaskell/network_tools/pull/3#discussion_r24784735","pull_request_url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/comments/24784735"},"html":{"href":"https://github.com/robertwhaskell/network_tools/pull/3#discussion_r24784735"},"pull_request":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/3","id":29158117,"html_url":"https://github.com/robertwhaskell/network_tools/pull/3","diff_url":"https://github.com/robertwhaskell/network_tools/pull/3.diff","patch_url":"https://github.com/robertwhaskell/network_tools/pull/3.patch","issue_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues/3","number":3,"state":"closed","locked":false,"title":"Http1","user":{"login":"robertwhaskell","id":8595188,"avatar_url":"https://avatars.githubusercontent.com/u/8595188?v=3","gravatar_id":"","url":"https://api.github.com/users/robertwhaskell","html_url":"https://github.com/robertwhaskell","followers_url":"https://api.github.com/users/robertwhaskell/followers","following_url":"https://api.github.com/users/robertwhaskell/following{/other_user}","gists_url":"https://api.github.com/users/robertwhaskell/gists{/gist_id}","starred_url":"https://api.github.com/users/robertwhaskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertwhaskell/subscriptions","organizations_url":"https://api.github.com/users/robertwhaskell/orgs","repos_url":"https://api.github.com/users/robertwhaskell/repos","events_url":"https://api.github.com/users/robertwhaskell/events{/privacy}","received_events_url":"https://api.github.com/users/robertwhaskell/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-12T07:33:22Z","updated_at":"2015-02-17T00:25:39Z","closed_at":"2015-02-12T07:39:40Z","merged_at":"2015-02-12T07:39:40Z","merge_commit_sha":"a21c22803f7d74070dd63a913ae3bb28e9239b6a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/3/commits","review_comments_url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/3/comments","review_comment_url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/comments/{number}","comments_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues/3/comments","statuses_url":"https://api.github.com/repos/robertwhaskell/network_tools/statuses/97e31562b0795406d35925ec4897a8f6b6f78935","head":{"label":"robertwhaskell:http1","ref":"http1","sha":"97e31562b0795406d35925ec4897a8f6b6f78935","user":{"login":"robertwhaskell","id":8595188,"avatar_url":"https://avatars.githubusercontent.com/u/8595188?v=3","gravatar_id":"","url":"https://api.github.com/users/robertwhaskell","html_url":"https://github.com/robertwhaskell","followers_url":"https://api.github.com/users/robertwhaskell/followers","following_url":"https://api.github.com/users/robertwhaskell/following{/other_user}","gists_url":"https://api.github.com/users/robertwhaskell/gists{/gist_id}","starred_url":"https://api.github.com/users/robertwhaskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertwhaskell/subscriptions","organizations_url":"https://api.github.com/users/robertwhaskell/orgs","repos_url":"https://api.github.com/users/robertwhaskell/repos","events_url":"https://api.github.com/users/robertwhaskell/events{/privacy}","received_events_url":"https://api.github.com/users/robertwhaskell/received_events","type":"User","site_admin":false},"repo":{"id":30573581,"name":"network_tools","full_name":"robertwhaskell/network_tools","owner":{"login":"robertwhaskell","id":8595188,"avatar_url":"https://avatars.githubusercontent.com/u/8595188?v=3","gravatar_id":"","url":"https://api.github.com/users/robertwhaskell","html_url":"https://github.com/robertwhaskell","followers_url":"https://api.github.com/users/robertwhaskell/followers","following_url":"https://api.github.com/users/robertwhaskell/following{/other_user}","gists_url":"https://api.github.com/users/robertwhaskell/gists{/gist_id}","starred_url":"https://api.github.com/users/robertwhaskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertwhaskell/subscriptions","organizations_url":"https://api.github.com/users/robertwhaskell/orgs","repos_url":"https://api.github.com/users/robertwhaskell/repos","events_url":"https://api.github.com/users/robertwhaskell/events{/privacy}","received_events_url":"https://api.github.com/users/robertwhaskell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robertwhaskell/network_tools","description":"A simple echo server and client","fork":false,"url":"https://api.github.com/repos/robertwhaskell/network_tools","forks_url":"https://api.github.com/repos/robertwhaskell/network_tools/forks","keys_url":"https://api.github.com/repos/robertwhaskell/network_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robertwhaskell/network_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robertwhaskell/network_tools/teams","hooks_url":"https://api.github.com/repos/robertwhaskell/network_tools/hooks","issue_events_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues/events{/number}","events_url":"https://api.github.com/repos/robertwhaskell/network_tools/events","assignees_url":"https://api.github.com/repos/robertwhaskell/network_tools/assignees{/user}","branches_url":"https://api.github.com/repos/robertwhaskell/network_tools/branches{/branch}","tags_url":"https://api.github.com/repos/robertwhaskell/network_tools/tags","blobs_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robertwhaskell/network_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/robertwhaskell/network_tools/languages","stargazers_url":"https://api.github.com/repos/robertwhaskell/network_tools/stargazers","contributors_url":"https://api.github.com/repos/robertwhaskell/network_tools/contributors","subscribers_url":"https://api.github.com/repos/robertwhaskell/network_tools/subscribers","subscription_url":"https://api.github.com/repos/robertwhaskell/network_tools/subscription","commits_url":"https://api.github.com/repos/robertwhaskell/network_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/robertwhaskell/network_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues/comments/{number}","contents_url":"https://api.github.com/repos/robertwhaskell/network_tools/contents/{+path}","compare_url":"https://api.github.com/repos/robertwhaskell/network_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robertwhaskell/network_tools/merges","archive_url":"https://api.github.com/repos/robertwhaskell/network_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robertwhaskell/network_tools/downloads","issues_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues{/number}","pulls_url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/robertwhaskell/network_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/robertwhaskell/network_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robertwhaskell/network_tools/labels{/name}","releases_url":"https://api.github.com/repos/robertwhaskell/network_tools/releases{/id}","created_at":"2015-02-10T03:46:27Z","updated_at":"2015-02-14T04:42:25Z","pushed_at":"2015-02-14T04:42:25Z","git_url":"git://github.com/robertwhaskell/network_tools.git","ssh_url":"git@github.com:robertwhaskell/network_tools.git","clone_url":"https://github.com/robertwhaskell/network_tools.git","svn_url":"https://github.com/robertwhaskell/network_tools","homepage":null,"size":0,"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":"robertwhaskell:master","ref":"master","sha":"8f6cc8befe9ddb095bbe9f90d95b3cbb464eb151","user":{"login":"robertwhaskell","id":8595188,"avatar_url":"https://avatars.githubusercontent.com/u/8595188?v=3","gravatar_id":"","url":"https://api.github.com/users/robertwhaskell","html_url":"https://github.com/robertwhaskell","followers_url":"https://api.github.com/users/robertwhaskell/followers","following_url":"https://api.github.com/users/robertwhaskell/following{/other_user}","gists_url":"https://api.github.com/users/robertwhaskell/gists{/gist_id}","starred_url":"https://api.github.com/users/robertwhaskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertwhaskell/subscriptions","organizations_url":"https://api.github.com/users/robertwhaskell/orgs","repos_url":"https://api.github.com/users/robertwhaskell/repos","events_url":"https://api.github.com/users/robertwhaskell/events{/privacy}","received_events_url":"https://api.github.com/users/robertwhaskell/received_events","type":"User","site_admin":false},"repo":{"id":30573581,"name":"network_tools","full_name":"robertwhaskell/network_tools","owner":{"login":"robertwhaskell","id":8595188,"avatar_url":"https://avatars.githubusercontent.com/u/8595188?v=3","gravatar_id":"","url":"https://api.github.com/users/robertwhaskell","html_url":"https://github.com/robertwhaskell","followers_url":"https://api.github.com/users/robertwhaskell/followers","following_url":"https://api.github.com/users/robertwhaskell/following{/other_user}","gists_url":"https://api.github.com/users/robertwhaskell/gists{/gist_id}","starred_url":"https://api.github.com/users/robertwhaskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertwhaskell/subscriptions","organizations_url":"https://api.github.com/users/robertwhaskell/orgs","repos_url":"https://api.github.com/users/robertwhaskell/repos","events_url":"https://api.github.com/users/robertwhaskell/events{/privacy}","received_events_url":"https://api.github.com/users/robertwhaskell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robertwhaskell/network_tools","description":"A simple echo server and client","fork":false,"url":"https://api.github.com/repos/robertwhaskell/network_tools","forks_url":"https://api.github.com/repos/robertwhaskell/network_tools/forks","keys_url":"https://api.github.com/repos/robertwhaskell/network_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robertwhaskell/network_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robertwhaskell/network_tools/teams","hooks_url":"https://api.github.com/repos/robertwhaskell/network_tools/hooks","issue_events_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues/events{/number}","events_url":"https://api.github.com/repos/robertwhaskell/network_tools/events","assignees_url":"https://api.github.com/repos/robertwhaskell/network_tools/assignees{/user}","branches_url":"https://api.github.com/repos/robertwhaskell/network_tools/branches{/branch}","tags_url":"https://api.github.com/repos/robertwhaskell/network_tools/tags","blobs_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robertwhaskell/network_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/robertwhaskell/network_tools/languages","stargazers_url":"https://api.github.com/repos/robertwhaskell/network_tools/stargazers","contributors_url":"https://api.github.com/repos/robertwhaskell/network_tools/contributors","subscribers_url":"https://api.github.com/repos/robertwhaskell/network_tools/subscribers","subscription_url":"https://api.github.com/repos/robertwhaskell/network_tools/subscription","commits_url":"https://api.github.com/repos/robertwhaskell/network_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/robertwhaskell/network_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/robertwhaskell/network_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues/comments/{number}","contents_url":"https://api.github.com/repos/robertwhaskell/network_tools/contents/{+path}","compare_url":"https://api.github.com/repos/robertwhaskell/network_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robertwhaskell/network_tools/merges","archive_url":"https://api.github.com/repos/robertwhaskell/network_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robertwhaskell/network_tools/downloads","issues_url":"https://api.github.com/repos/robertwhaskell/network_tools/issues{/number}","pulls_url":"https://api.github.com/repos/robertwhaskell/network_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/robertwhaskell/network_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/robertwhaskell/network_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robertwhaskell/network_tools/labels{/name}","releases_url":"https://api.github.com/repos/robertwhaskell/network_tools/releases{/id}","created_at":"2015-02-10T03:46:27Z","updated_at":"2015-02-14T04:42:25Z","pushed_at":"2015-02-14T04:42:25Z","git_url":"git://github.com/robertwhaskell/network_tools.git","ssh_url":"git@github.com:robertwhaskell/network_tools.git","clone_url":"https://github.com/robertwhaskell/network_tools.git","svn_url":"https://github.com/robertwhaskell/network_tools","homepage":null,"size":0,"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/robertwhaskell/network_tools/pulls/3"},"html":{"href":"https://github.com/robertwhaskell/network_tools/pull/3"},"issue":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/issues/3"},"comments":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/robertwhaskell/network_tools/statuses/97e31562b0795406d35925ec4897a8f6b6f78935"}}}}