test_node_application.py (1295:f60a68728306) test_node_application.py (1453:71af60a59338)
1import unittest
2from unit.applications.lang.node import TestApplicationNode
3
4
5class TestNodeApplication(TestApplicationNode):
6 prerequisites = {'modules': ['node']}
7
8 def test_node_application_basic(self):

--- 98 unchanged lines hidden (view full) ---

107 resp['body'], r'<title>404 Not Found</title>', '404 body'
108 )
109
110 def test_node_keepalive_body(self):
111 self.load('mirror')
112
113 self.assertEqual(self.get()['status'], 200, 'init')
114
1import unittest
2from unit.applications.lang.node import TestApplicationNode
3
4
5class TestNodeApplication(TestApplicationNode):
6 prerequisites = {'modules': ['node']}
7
8 def test_node_application_basic(self):

--- 98 unchanged lines hidden (view full) ---

107 resp['body'], r'<title>404 Not Found</title>', '404 body'
108 )
109
110 def test_node_keepalive_body(self):
111 self.load('mirror')
112
113 self.assertEqual(self.get()['status'], 200, 'init')
114
115 body = '0123456789' * 500
115 (resp, sock) = self.post(
116 headers={
117 'Host': 'localhost',
118 'Connection': 'keep-alive',
119 'Content-Type': 'text/html',
120 },
121 start=True,
116 (resp, sock) = self.post(
117 headers={
118 'Host': 'localhost',
119 'Connection': 'keep-alive',
120 'Content-Type': 'text/html',
121 },
122 start=True,
122 body='0123456789' * 500,
123 body=body,
123 read_timeout=1,
124 )
125
126 self.assertEqual(resp['body'], '0123456789' * 500, 'keep-alive 1')
127
124 read_timeout=1,
125 )
126
127 self.assertEqual(resp['body'], '0123456789' * 500, 'keep-alive 1')
128
129 body = '0123456789'
128 resp = self.post(
129 headers={
130 'Host': 'localhost',
131 'Connection': 'close',
132 'Content-Type': 'text/html',
133 },
134 sock=sock,
130 resp = self.post(
131 headers={
132 'Host': 'localhost',
133 'Connection': 'close',
134 'Content-Type': 'text/html',
135 },
136 sock=sock,
135 body='0123456789',
137 body=body,
136 )
137
138 )
139
138 self.assertEqual(resp['body'], '0123456789', 'keep-alive 2')
140 self.assertEqual(resp['body'], body, 'keep-alive 2')
139
140 def test_node_application_write_buffer(self):
141 self.load('write_buffer')
142
143 self.assertEqual(
144 self.get()['body'], 'buffer', 'write buffer'
145 )
146

--- 246 unchanged lines hidden ---
141
142 def test_node_application_write_buffer(self):
143 self.load('write_buffer')
144
145 self.assertEqual(
146 self.get()['body'], 'buffer', 'write buffer'
147 )
148

--- 246 unchanged lines hidden ---