##// END OF EJS Templates
tests: fix duplicate and failing test...
Gregory Szorc -
r37302:12bfc724 default
parent child Browse files
Show More
@@ -174,8 +174,8 b' class FrameTests(unittest.TestCase):'
174 ])
174 ])
175
175
176 class ServerReactorTests(unittest.TestCase):
176 class ServerReactorTests(unittest.TestCase):
177 def _sendsingleframe(self, reactor, s):
177 def _sendsingleframe(self, reactor, f):
178 results = list(sendframes(reactor, [ffs(s)]))
178 results = list(sendframes(reactor, [f]))
179 self.assertEqual(len(results), 1)
179 self.assertEqual(len(results), 1)
180
180
181 return results[0]
181 return results[0]
@@ -296,7 +296,7 b' class ServerReactorTests(unittest.TestCa'
296 def testunexpectedcommandargument(self):
296 def testunexpectedcommandargument(self):
297 """Command argument frame when not running a command is an error."""
297 """Command argument frame when not running a command is an error."""
298 result = self._sendsingleframe(makereactor(),
298 result = self._sendsingleframe(makereactor(),
299 b'1 command-argument 0 ignored')
299 ffs(b'1 command-argument 0 ignored'))
300 self.assertaction(result, 'error')
300 self.assertaction(result, 'error')
301 self.assertEqual(result[1], {
301 self.assertEqual(result[1], {
302 'message': b'expected command frame; got 2',
302 'message': b'expected command frame; got 2',
@@ -318,7 +318,7 b' class ServerReactorTests(unittest.TestCa'
318 def testunexpectedcommanddata(self):
318 def testunexpectedcommanddata(self):
319 """Command argument frame when not running a command is an error."""
319 """Command argument frame when not running a command is an error."""
320 result = self._sendsingleframe(makereactor(),
320 result = self._sendsingleframe(makereactor(),
321 b'1 command-data 0 ignored')
321 ffs(b'1 command-data 0 ignored'))
322 self.assertaction(result, 'error')
322 self.assertaction(result, 'error')
323 self.assertEqual(result[1], {
323 self.assertEqual(result[1], {
324 'message': b'expected command frame; got 3',
324 'message': b'expected command frame; got 3',
@@ -340,19 +340,32 b' class ServerReactorTests(unittest.TestCa'
340 def testmissingcommandframeflags(self):
340 def testmissingcommandframeflags(self):
341 """Command name frame must have flags set."""
341 """Command name frame must have flags set."""
342 result = self._sendsingleframe(makereactor(),
342 result = self._sendsingleframe(makereactor(),
343 b'1 command-name 0 command')
343 ffs(b'1 command-name 0 command'))
344 self.assertaction(result, 'error')
344 self.assertaction(result, 'error')
345 self.assertEqual(result[1], {
345 self.assertEqual(result[1], {
346 'message': b'missing frame flags on command frame',
346 'message': b'missing frame flags on command frame',
347 })
347 })
348
348
349 def testconflictingrequestid(self):
349 def testconflictingrequestidallowed(self):
350 """Multiple fully serviced commands with same request ID is allowed."""
350 """Multiple fully serviced commands with same request ID is allowed."""
351 results = list(sendframes(makereactor(), [
351 reactor = makereactor()
352 ffs(b'1 command-name eos command'),
352 results = []
353 ffs(b'1 command-name eos command'),
353 results.append(self._sendsingleframe(
354 ffs(b'1 command-name eos command'),
354 reactor, ffs(b'1 command-name eos command')))
355 ]))
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 for i in range(3):
369 for i in range(3):
357 self.assertaction(results[i], 'runcommand')
370 self.assertaction(results[i], 'runcommand')
358 self.assertEqual(results[i][1], {
371 self.assertEqual(results[i][1], {
General Comments 0
You need to be logged in to leave comments. Login now