869
869
self.assertEqual(output, expected_output)
871
class TestDumpJSONCmd(TestCmd):
873
self.expected_json = {
876
"KeyID": ("92ed150794387c03ce684574b1139a65"
877
"94a34f895daaaf09fd8ea90a27cddb12"),
878
"Host": "foo.example.org",
881
"LastCheckedOK": "2019-02-03T00:00:00",
882
"Created": "2019-01-02T00:00:00",
884
"Fingerprint": ("778827225BA7DE539C5A"
885
"7CFA59CFF7CDBD9A5920"),
886
"CheckerRunning": False,
887
"LastEnabled": "2019-01-03T00:00:00",
888
"ApprovalPending": False,
889
"ApprovedByDefault": True,
890
"LastApprovalRequest": "",
892
"ApprovalDuration": 1000,
893
"Checker": "fping -q -- %(host)s",
894
"ExtendedTimeout": 900000,
895
"Expires": "2019-02-04T00:00:00",
896
"LastCheckerStatus": 0,
900
"KeyID": ("0558568eedd67d622f5c83b35a115f79"
901
"6ab612cff5ad227247e46c2b020f441c"),
905
"LastCheckedOK": "2019-02-04T00:00:00",
906
"Created": "2019-01-03T00:00:00",
908
"Fingerprint": ("3E393AEAEFB84C7E89E2"
909
"F547B3A107558FCA3A27"),
910
"CheckerRunning": True,
911
"LastEnabled": "2019-01-04T00:00:00",
912
"ApprovalPending": False,
913
"ApprovedByDefault": False,
914
"LastApprovalRequest": "2019-01-03T00:00:00",
915
"ApprovalDelay": 30000,
916
"ApprovalDuration": 1000,
918
"ExtendedTimeout": 900000,
919
"Expires": "2019-02-05T00:00:00",
920
"LastCheckerStatus": -2,
923
return super(TestDumpJSONCmd, self).setUp()
924
def test_normal(self):
925
json_data = json.loads(DumpJSONCmd().output(self.clients))
926
self.assertDictEqual(json_data, self.expected_json)
927
def test_one_client(self):
928
clients = {"foo": self.clients["foo"]}
929
json_data = json.loads(DumpJSONCmd().output(clients))
930
expected_json = {"foo": self.expected_json["foo"]}
931
self.assertDictEqual(json_data, expected_json)
873
934
def should_only_run_tests():