@@ -0,0 +1,1948 @@
+#!/usr/bin/env python%0Aimport pytest%0Afrom http_server import parse_request, parse_init_req_line, responseHeaders, buildResponse, raiseResponse, getResource%0A%0Agood_request = %22GET webroot/images/Sample_Scene_Balls.jpg HTTP/1.1%5Cr%5CnHeader1: I don't really get what goes into a request header.%22%0Abad_method_call = %22GIT webroot/sample.txt HTTP/1.1%5Cr%5CnHeader1: Providing header data as part of an http request is called giving head.%22%0Abad_http_version = %22GET funWithThreads.py HTTP/1.0%5Cr%5CnHeader1: No one is reading my ridiculous test files, I assume.%22%0Anonsense = %22Groop doopery dupe. Skadoosh!%22%0A%0Adef test_good_request():%0A    x = parse_request(good_request)%5B0%5D%0A    assert x == %22GET webroot/images/Sample_Scene_Balls.jpg HTTP/1.1%22%0A    assert parse_init_req_line(x)%5B0%5D == %22webroot/images/Sample_Scene_Balls.jpg%22%0A    assert parse_init_req_line(x)%5B1%5D == 200%0A%0Adef test_405():%0A    x = parse_request(bad_method_call)%5B0%5D%0A    assert x == %22GIT webroot/sample.txt HTTP/1.1%22%0A    assert parse_init_req_line(x)%5B0%5D == %22webroot/sample.txt%22%0A    assert parse_init_req_line(x)%5B1%5D == 405%0A%0Adef test_400():%0A    x = parse_request(bad_http_version)%5B0%5D%0A    assert x == %22GET funWithThreads.py HTTP/1.0%22%0A    assert parse_init_req_line(x)%5B0%5D == %22funWithThreads.py%22%0A    assert parse_init_req_line(x)%5B1%5D == 400%0A%0Adef test_responseHeaders():%0A    h = responseHeaders('type', 'now', '1 million')%0A    assert h%5B'Content-Type'%5D == 'type'%0A    assert h%5B'Date'%5D == 'now'%0A    assert h%5B'Server'%5D == 'ServerTron4000'%0A    assert h%5B'Content-Length'%5D == '1 million'%0A%0Adef test_buildResponse():%0A    uri = parse_init_req_line(parse_request(good_request)%5B0%5D)%5B0%5D%0A    b = getResource(uri)%5B2%5D%0A    h = responseHeaders(getResource(uri)%5B0%5D, 'Today', getResource(uri)%5B1%5D)%0A    response = buildResponse(%22HTTP/1.1 %22+str(getResource(uri)%5B3%5D)+%22 OK%22, h, b)%0A    assert %22HTTP/1.1 200 OK%22 in response%0A    assert %22image/jpg%22 in response%0A    assert %22Requested resource is an image. Here is it's binary data vomit:%22 in response%0A

Add unit tests