def content_type_matches_mimetype(): request = _Request(None) resource = StaticResource(_test_file_path('test.txt')) resource.handle(request) response_headers = request.get_response_header_list() assert_in(('content-type', 'text/plain'), response_headers)
def handling_static_resources_returns_contents_of_file(): test_file_path = _test_file_path('test.txt') with open(test_file_path) as test_file: expected = test_file.read() resource = StaticResource(test_file_path) assert_equal(expected, resource.handle(_Request(None)))