OPSI.web2.test.test_client module

class OPSI.web2.test.test_client.ClientTests(methodName='runTest')

Bases: OPSI.web2.test.test_http.HTTPTests

assertDone(cxn)
assertHeaders(resp, expectedHeaders)
assertReceived(cxn, expectedStatus, expectedHeaders, expectedContent=None)
checkResponse(resp, code, headers, length, data)

Assert various things about a response: http code, headers, stream length, and data in stream.

connect(logFile=None, maxPipeline=4, inputTimeOut=60000, betweenRequestsTimeOut=600000)
writeLines(cxn, lines)
writeToClient(cxn, data)
class OPSI.web2.test.test_client.TestEdgeCases(methodName='runTest')

Bases: OPSI.web2.test.test_client.ClientTests

test_errorReadingRequestStream()

Ensure that stream errors are propagated to the response.

test_newServer()

Check that an error is returned if the server is a new major version.

test_serverDoesntSendConnectionClose()

Check that a lost connection is treated as end of response, if we requested connection: close, even if the server didn’t respond with connection: close.

test_serverIsntHttp()

Check that an error is returned if the server doesn’t talk HTTP.

test_shortStatus()

Check that an error is returned if the response line is invalid.

class OPSI.web2.test.test_client.TestHTTPClient(methodName='runTest')

Bases: OPSI.web2.test.test_client.ClientTests

Test that the http client works.

test_chunkedUpload()

Ensure chunked data is correctly decoded on upload.

test_delayedContent()

Make sure that the client returns the response object as soon as the headers are received, even if the data hasn’t arrived yet.

test_prematurePipelining()

Ensure that submitting a second request before it’s allowed results in an AssertionError.

test_sentHead()

Ensure that HEAD requests work, and return Content-Length.

test_sentHeadKeepAlive()

Ensure that keepalive works right after a HEAD request.

test_simpleRequest()

Your basic simple HTTP Request.

test_streamedUpload()

Make sure that sending request content works.

test_userHeaders()

Make sure that headers get through in both directions.

class OPSI.web2.test.test_client.TestServer

Bases: twisted.internet.protocol.Protocol

connectionLost(reason)
data = ''
dataReceived(data)
done = False
loseConnection()
write(data)