Conversation
These were largely based on the old tests in https://github.com/github/codeql/blob/6011cb74f8df6f7b0c304e59c0abe8acf79fc7b4/python/ql/test/library-tests/web/twisted/test.py
yoff
left a comment
There was a problem hiding this comment.
There are a number of patterns on https://twistedmatrix.com/, but we only really deal with "web server". This seems to be intentional, given the change note, but I wanted to double check :-)
python/ql/test/library-tests/frameworks/twisted/response_test.py
Outdated
Show resolved
Hide resolved
| exists(int i | | ||
| resourceMethodRequestParamIndex(this.getName(), i) and | ||
| result = this.getArg(i) | ||
| ) |
There was a problem hiding this comment.
If resourceMethodRequestParamIndex were to return the index rather than take it as a second parameter, this bit could be written as result = this.getArg(resourceMethodRequestParamIndex(this.getName())).
It would mean that resourceMethodRequestParamIndex(result.getName(), _) would have to be changed to exists(resourceMethodRequestParamIndex(result.getName()), which is longer but does read a bit more explicitly.
There was a problem hiding this comment.
I don't mind much, but it was not a hard change, so there it is
|
|
||
| def process_later(request: Request): | ||
| print("process_later called") | ||
| request.write(b"later") # $ MISSING: responseBody=b"later" |
There was a problem hiding this comment.
Because process_later is invoked through reactor.callLater(1, process_later, request), and we currently have no way to simulate this call happening.
There was a problem hiding this comment.
Ah, I see now. TwistedResourceRequestHendler would have to close under such delegating calls. I think it is fine to just have the test case documenting the limitation for now.
Co-authored-by: yoff <lerchedahl@gmail.com>
yes, this is intentional. Just like for |
No description provided.