diff options
| author | Andrei Belov <defan@nginx.com> | 2020-02-06 18:25:25 +0300 |
|---|---|---|
| committer | Andrei Belov <defan@nginx.com> | 2020-02-06 18:25:25 +0300 |
| commit | 2dc01938cf02cc05b41a09e618f712129c4cdf91 (patch) | |
| tree | 556dd40a0ec8c194774d53eed9ff62ed1d25ee7c /test/test_java_application.py | |
| parent | 477a58e14010ab14d6ab453860b360cf806f5012 (diff) | |
| parent | 6e19090736612b39d4c5d0836d7df0722b8955e7 (diff) | |
| download | unit-1.15.0-1.tar.gz unit-1.15.0-1.tar.bz2 | |
Merged with the default branch.1.15.0-1
Diffstat (limited to '')
| -rw-r--r-- | test/test_java_application.py | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/test/test_java_application.py b/test/test_java_application.py index d2b97f88..9d873d6b 100644 --- a/test/test_java_application.py +++ b/test/test_java_application.py @@ -1,3 +1,4 @@ +import io import os import time import unittest @@ -1223,31 +1224,25 @@ class TestJavaApplication(TestApplicationJava): os.mkdir(fulldst) self.public_dir(fulldst) - body = ( - """Preamble. Should be ignored.\r -\r ---12345\r -Content-Disposition: form-data; name="file"; filename="sample.txt"\r -Content-Type: text/plain\r -\r -Data from sample file\r ---12345\r -Content-Disposition: form-data; name="destination"\r -\r -%s\r ---12345\r -Content-Disposition: form-data; name="upload"\r -\r -Upload\r ---12345--\r -\r -Epilogue. Should be ignored.""" - % fulldst - ) + fields = { + 'file': { + 'filename': 'sample.txt', + 'type': 'text/plain', + 'data': io.StringIO('Data from sample file'), + }, + 'destination': fulldst, + 'upload': 'Upload', + } + + encoded, content_type = self.multipart_encode(fields) + + preamble = 'Preamble. Should be ignored.' + epilogue = 'Epilogue. Should be ignored.' + body = "%s\r\n%s\r\n%s" % (preamble, encoded.decode(), epilogue) resp = self.post( headers={ - 'Content-Type': 'multipart/form-data; boundary=12345', + 'Content-Type': content_type, 'Host': 'localhost', 'Connection': 'close', }, |
