summaryrefslogtreecommitdiffhomepage
path: root/test/test_java_application.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2019-08-07 14:43:38 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2019-08-07 14:43:38 +0300
commite8d1c760d6c8134c809d2bb60c212743fdbb9b16 (patch)
tree6f29d32606147b4e1428fe71b4161960a17c7dc8 /test/test_java_application.py
parentc8c259b9728c57e70042d7630045e5b043f46e5b (diff)
downloadunit-e8d1c760d6c8134c809d2bb60c212743fdbb9b16.tar.gz
unit-e8d1c760d6c8134c809d2bb60c212743fdbb9b16.tar.bz2
Tests: Java multipart test.
Diffstat (limited to 'test/test_java_application.py')
-rw-r--r--test/test_java_application.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test_java_application.py b/test/test_java_application.py
index f604368c..2e22e545 100644
--- a/test/test_java_application.py
+++ b/test/test_java_application.py
@@ -1,4 +1,5 @@
import time
+import unittest
from unit.applications.lang.java import TestApplicationJava
@@ -1213,6 +1214,44 @@ class TestJavaApplication(TestApplicationJava):
)
self.assertEqual(headers['X-Get-Date'], date, 'get date header')
+ @unittest.skip('not yet')
+ def test_java_application_multipart(self):
+ self.load('multipart')
+
+ 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.""" % self.testdir
+
+ resp = self.post(
+ headers={
+ 'Content-Type': 'multipart/form-data; boundary=12345',
+ 'Host': 'localhost',
+ 'Connection': 'close',
+ },
+ body=body,
+ )
+
+ self.assertEqual(resp['status'], 200, 'multipart status')
+ self.assertRegex(resp['body'], r'sample\.txt created', 'multipart body')
+ self.assertIsNotNone(
+ self.search_in_log(r'^Data from sample file$', name='sample.txt'),
+ 'file created',
+ )
if __name__ == '__main__':
TestJavaApplication.main()