Show More
@@ -174,8 +174,8 b' class FrameTests(unittest.TestCase):' | |||
|
174 | 174 | ]) |
|
175 | 175 | |
|
176 | 176 | class ServerReactorTests(unittest.TestCase): |
|
177 |
def _sendsingleframe(self, reactor, |
|
|
178 |
results = list(sendframes(reactor, [f |
|
|
177 | def _sendsingleframe(self, reactor, f): | |
|
178 | results = list(sendframes(reactor, [f])) | |
|
179 | 179 | self.assertEqual(len(results), 1) |
|
180 | 180 | |
|
181 | 181 | return results[0] |
@@ -296,7 +296,7 b' class ServerReactorTests(unittest.TestCa' | |||
|
296 | 296 | def testunexpectedcommandargument(self): |
|
297 | 297 | """Command argument frame when not running a command is an error.""" |
|
298 | 298 | result = self._sendsingleframe(makereactor(), |
|
299 | b'1 command-argument 0 ignored') | |
|
299 | ffs(b'1 command-argument 0 ignored')) | |
|
300 | 300 | self.assertaction(result, 'error') |
|
301 | 301 | self.assertEqual(result[1], { |
|
302 | 302 | 'message': b'expected command frame; got 2', |
@@ -318,7 +318,7 b' class ServerReactorTests(unittest.TestCa' | |||
|
318 | 318 | def testunexpectedcommanddata(self): |
|
319 | 319 | """Command argument frame when not running a command is an error.""" |
|
320 | 320 | result = self._sendsingleframe(makereactor(), |
|
321 | b'1 command-data 0 ignored') | |
|
321 | ffs(b'1 command-data 0 ignored')) | |
|
322 | 322 | self.assertaction(result, 'error') |
|
323 | 323 | self.assertEqual(result[1], { |
|
324 | 324 | 'message': b'expected command frame; got 3', |
@@ -340,19 +340,32 b' class ServerReactorTests(unittest.TestCa' | |||
|
340 | 340 | def testmissingcommandframeflags(self): |
|
341 | 341 | """Command name frame must have flags set.""" |
|
342 | 342 | result = self._sendsingleframe(makereactor(), |
|
343 | b'1 command-name 0 command') | |
|
343 | ffs(b'1 command-name 0 command')) | |
|
344 | 344 | self.assertaction(result, 'error') |
|
345 | 345 | self.assertEqual(result[1], { |
|
346 | 346 | 'message': b'missing frame flags on command frame', |
|
347 | 347 | }) |
|
348 | 348 | |
|
349 | def testconflictingrequestid(self): | |
|
349 | def testconflictingrequestidallowed(self): | |
|
350 | 350 | """Multiple fully serviced commands with same request ID is allowed.""" |
|
351 |
re |
|
|
352 | ffs(b'1 command-name eos command'), | |
|
353 | ffs(b'1 command-name eos command'), | |
|
354 |
ffs(b'1 command-name eos command') |
|
|
355 | ])) | |
|
351 | reactor = makereactor() | |
|
352 | results = [] | |
|
353 | results.append(self._sendsingleframe( | |
|
354 | reactor, ffs(b'1 command-name eos command'))) | |
|
355 | result = reactor.onbytesresponseready(1, b'response1') | |
|
356 | self.assertaction(result, 'sendframes') | |
|
357 | list(result[1]['framegen']) | |
|
358 | results.append(self._sendsingleframe( | |
|
359 | reactor, ffs(b'1 command-name eos command'))) | |
|
360 | result = reactor.onbytesresponseready(1, b'response2') | |
|
361 | self.assertaction(result, 'sendframes') | |
|
362 | list(result[1]['framegen']) | |
|
363 | results.append(self._sendsingleframe( | |
|
364 | reactor, ffs(b'1 command-name eos command'))) | |
|
365 | result = reactor.onbytesresponseready(1, b'response3') | |
|
366 | self.assertaction(result, 'sendframes') | |
|
367 | list(result[1]['framegen']) | |
|
368 | ||
|
356 | 369 | for i in range(3): |
|
357 | 370 | self.assertaction(results[i], 'runcommand') |
|
358 | 371 | self.assertEqual(results[i][1], { |
General Comments 0
You need to be logged in to leave comments.
Login now