Revision e9c73313 kamaki/cli/argument/test.py

b/kamaki/cli/argument/test.py
369 369
        pba.value = None
370 370
        msg, msg_len = 'message', 40
371 371
        with patch('%s.KamakiProgressBar.start' % arg_path) as start:
372
            pba.get_generator(msg, msg_len)
373
            self.assertTrue(isinstance(pba.bar, argument.KamakiProgressBar))
374
            self.assertNotEqual(pba.bar.message, msg)
375
            self.assertEqual(
376
                pba.bar.message, '%s%s' % (msg, ' ' * (msg_len - len(msg))))
377
            self.assertEqual(pba.bar.suffix, '%(percent)d%% - %(eta)ds')
378
            start.assert_called_once()
372
            try:
373
                pba.get_generator(msg, msg_len)
374
                self.assertTrue(
375
                    isinstance(pba.bar, argument.KamakiProgressBar))
376
                self.assertNotEqual(pba.bar.message, msg)
377
                self.assertEqual(pba.bar.message, '%s%s' % (
378
                    msg, ' ' * (msg_len - len(msg))))
379
                self.assertEqual(pba.bar.suffix, '%(percent)d%% - %(eta)ds')
380
                start.assert_called_once()
381

  
382
                pba.get_generator(msg, msg_len, timeout=True)
383
                self.assertTrue(
384
                    isinstance(pba.bar, argument.KamakiProgressBar))
385
                self.assertNotEqual(pba.bar.message, msg)
386
                self.assertEqual(pba.bar.message, '%s%s' % (
387
                    msg, ' ' * (msg_len - len(msg))))
388
                self.assertEqual(pba.bar.bar_prefix, ' (Timeout:')
389
                self.assertEqual(pba.bar.suffix, '%(eta)ds)')
390
            finally:
391
                try:
392
                    pba.finish()
393
                except Exception:
394
                    pass
379 395

  
380 396
    def test_finish(self):
381 397
        pba = argument.ProgressBarArgument(parsed_name='--progress')

Also available in: Unified diff