/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-03-12 20:37:00 UTC
  • Revision ID: teddy@recompile.se-20190312203700-psenofay84b3szip
mandos-ctl: Refactor

* mandos-ctl (TestEnableCmd, TestDisableCmd): Rewrite to inherit from
                                              TestPropertyCmd instead
                                              of TestCmd.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1521
1521
        self.command().run(clients, self.bus)
1522
1522
 
1523
1523
 
1524
 
class TestEnableCmd(TestCmd):
1525
 
    def test_enable(self):
1526
 
        for clientpath in self.clients:
1527
 
            client = self.bus.get_object(dbus_busname, clientpath)
1528
 
            client.attributes["Enabled"] = False
1529
 
 
1530
 
        EnableCmd().run(self.clients, self.bus)
1531
 
 
1532
 
        for clientpath in self.clients:
1533
 
            client = self.bus.get_object(dbus_busname, clientpath)
1534
 
            self.assertTrue(client.attributes["Enabled"])
1535
 
 
1536
 
 
1537
 
class TestDisableCmd(TestCmd):
1538
 
    def test_disable(self):
1539
 
        DisableCmd().run(self.clients, self.bus)
1540
 
        for clientpath in self.clients:
1541
 
            client = self.bus.get_object(dbus_busname, clientpath)
1542
 
            self.assertFalse(client.attributes["Enabled"])
 
1524
class TestEnableCmd(TestPropertyCmd):
 
1525
    command = EnableCmd
 
1526
    propname = "Enabled"
 
1527
    values_to_set = [dbus.Boolean(True)]
 
1528
 
 
1529
 
 
1530
class TestDisableCmd(TestPropertyCmd):
 
1531
    command = DisableCmd
 
1532
    propname = "Enabled"
 
1533
    values_to_set = [dbus.Boolean(False)]
1543
1534
 
1544
1535
 
1545
1536
class TestBumpTimeoutCmd(TestPropertyCmd):