/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-04 19:03:10 UTC
  • Revision ID: teddy@recompile.se-20190304190310-n6brlijq8s692dok
mandos-ctl: New tests for ApproveCmd and DenyCmd

* mandos-ctl (TestCmd.MockClient.Approve): New method.
  (TestApproveCmd, TestDenyCmd): New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
795
795
                self.calls.append(("Get", (interface, property,
796
796
                                           dbus_interface)))
797
797
                return self.attributes[property]
 
798
            def Approve(self, approve, dbus_interface):
 
799
                testcase.assertEqual(dbus_interface, client_interface)
 
800
                self.calls.append(("Approve", (approve,
 
801
                                               dbus_interface)))
798
802
            def __getitem__(self, key):
799
803
                return self.attributes[key]
800
804
            def __setitem__(self, key, value):
967
971
        else:
968
972
            self.assertIsNotNone(e.exception.code)
969
973
 
970
 
 
971
974
class TestRemoveCmd(TestCmd):
972
975
    def test_remove(self):
973
976
        class MockMandos(object):
982
985
                             [("RemoveClient",
983
986
                               (self.client.__dbus_object_path__,))])
984
987
 
 
988
class TestApproveCmd(TestCmd):
 
989
    def test_approve(self):
 
990
        ApproveCmd().run(None, [self.client])
 
991
        self.assertListEqual(self.client.calls,
 
992
                             [("Approve", (True, client_interface))])
 
993
class TestDenyCmd(TestCmd):
 
994
    def test_approve(self):
 
995
        DenyCmd().run(None, [self.client])
 
996
        self.assertListEqual(self.client.calls,
 
997
                             [("Approve", (False, client_interface))])
 
998
 
985
999
 
986
1000
 
987
1001
def should_only_run_tests():