/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2019-02-28 18:54:11 UTC
  • Revision ID: teddy@recompile.se-20190228185411-71f49cg8plsvdkub
Add tests to mandos-ctl's milliseconds_to_string function

* mandos-ctl (Test_milliseconds_to_string): New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
490
490
                               dbus_interface=client_interface)
491
491
 
492
492
 
 
493
class Test_milliseconds_to_string(unittest.TestCase):
 
494
    def test_all(self):
 
495
        self.assertEqual(milliseconds_to_string(93785000),
 
496
                         "1T02:03:05")
 
497
    def test_no_days(self):
 
498
        self.assertEqual(milliseconds_to_string(7385000), "02:03:05")
 
499
    def test_all_zero(self):
 
500
        self.assertEqual(milliseconds_to_string(0), "00:00:00")
 
501
    def test_no_fractional_seconds(self):
 
502
        self.assertEqual(milliseconds_to_string(400), "00:00:00")
 
503
        self.assertEqual(milliseconds_to_string(900), "00:00:00")
 
504
        self.assertEqual(milliseconds_to_string(1900), "00:00:01")
 
505
 
 
506
 
493
507
def should_only_run_tests():
494
508
    parser = argparse.ArgumentParser(add_help=False)
495
509
    parser.add_argument("--check", action='store_true')