globaleaks/GLBackend — pull request #190 by vecna (2013-10-03 00:22:44+00:00)
Title: enhanced test to spot a file upload bug

https://github.com/globaleaks/GlobaLeaks/issues/638

and it's something not very easy to be tested, as described in the comment:

class TestAdminStaticFile(helpers.TestHandler):
"""
Sadly we can't use the official handler test, because in a
file upload, Cyclone and GL patches transform the body in a StringIO.

So the code in GLBackend expect a StringIO. If here I use the handlers,
with a StringIO inside, can't be JSON-ized.

If I send a real dict to the handler, the GLBackend code fail, because
expect a StringIO.

If I support in the handler both kind of data, well, no. I would not
change the handler code just to fit our test.

So... that's shit, but _post hanlder is tested in a more direct way
"""
_handler = admstaticfiles.StaticFileCollection