/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-13 21:52:43 UTC
  • Revision ID: teddy@recompile.se-20190313215243-nq6o9hqve19qlwxe
mandos-ctl: Bug fix: Make --dump-json/-j work again.

* mandos-ctl (DumpJSONCmd.output): Don't do .values() on "clients".
  (TestDumpJSONCmd.test_normal, TestDumpJSONCmd.test_one_client): Call
  .values on clients dict before passing to output() method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
590
590
        data = {client["Name"]:
591
591
                {key: self.dbus_boolean_to_bool(client[key])
592
592
                 for key in self.all_keywords}
593
 
                for client in clients.values()}
 
593
                for client in clients}
594
594
        return json.dumps(data, indent=4, separators=(',', ': '))
595
595
 
596
596
    @staticmethod
1391
1391
        return super(TestDumpJSONCmd, self).setUp()
1392
1392
 
1393
1393
    def test_normal(self):
1394
 
        json_data = json.loads(DumpJSONCmd().output(self.clients))
 
1394
        output = DumpJSONCmd().output(self.clients.values())
 
1395
        json_data = json.loads(output)
1395
1396
        self.assertDictEqual(json_data, self.expected_json)
1396
1397
 
1397
1398
    def test_one_client(self):
1398
 
        clients = self.one_client
1399
 
        json_data = json.loads(DumpJSONCmd().output(clients))
 
1399
        output = DumpJSONCmd().output(self.one_client.values())
 
1400
        json_data = json.loads(output)
1400
1401
        expected_json = {"foo": self.expected_json["foo"]}
1401
1402
        self.assertDictEqual(json_data, expected_json)
1402
1403