934
934
def test_verbose(self):
935
935
output = PrintTableCmd(verbose=True).output(
936
936
self.clients.values())
937
expected_output = "\n".join((
938
# First line (headers)
939
"Name Enabled Timeout Last Successful Check Created "
940
" Interval Host Key ID "
942
" Check Is Running Last Enabl"
943
"ed Approval Is Pending Approved By Default Last A"
944
"pproval Request Approval Delay Approval Duration Checker"
945
" Extended Timeout Expires Last "
947
# Second line (client "foo")
948
"foo Yes 00:05:00 2019-02-03T00:00:00 2019-01-02"
949
"T00:00:00 00:02:00 foo.example.org 92ed150794387c03ce684"
950
"574b1139a6594a34f895daaaf09fd8ea90a27cddb12 778827225BA7"
951
"DE539C5A7CFA59CFF7CDBD9A5920 No 2019-01-03"
953
" 00:00:00 00:00:01 fping -"
954
"q -- %(host)s 00:15:00 2019-02-04T00:00:00 0 "
956
# Third line (client "barbar")
957
"barbar Yes 00:05:00 2019-02-04T00:00:00 2019-01-03"
958
"T00:00:00 00:02:00 192.0.2.3 0558568eedd67d622f5c8"
959
"3b35a115f796ab612cff5ad227247e46c2b020f441c 3E393AEAEFB8"
960
"4C7E89E2F547B3A107558FCA3A27 Yes 2019-01-04"
961
"T00:00:00 No No 2019-0"
962
"1-03T00:00:00 00:00:30 00:00:01 : "
963
" 00:15:00 2019-02-05T00:00:00 -2 "
951
"Last Successful Check ",
952
"2019-02-03T00:00:00 ",
953
"2019-02-04T00:00:00 ",
956
"2019-01-02T00:00:00 ",
957
"2019-01-03T00:00:00 ",
969
("92ed150794387c03ce684574b1139a6594a34f895daaaf09fd8"
971
("0558568eedd67d622f5c83b35a115f796ab612cff5ad227247e"
975
"778827225BA7DE539C5A7CFA59CFF7CDBD9A5920 ",
976
"3E393AEAEFB84C7E89E2F547B3A107558FCA3A27 ",
983
"2019-01-03T00:00:00 ",
984
"2019-01-04T00:00:00 ",
986
"Approval Is Pending ",
990
"Approved By Default ",
994
"Last Approval Request ",
996
"2019-01-03T00:00:00 ",
1002
"Approval Duration ",
1007
"fping -q -- %(host)s ",
1010
"Extended Timeout ",
1015
"2019-02-04T00:00:00 ",
1016
"2019-02-05T00:00:00 ",
1018
"Last Checker Status",
1023
num_lines = max(len(rows) for rows in columns)
1024
expected_output = "\n".join("".join(rows[line]
1025
for rows in columns)
1026
for line in range(num_lines))
966
1027
self.assertEqual(output, expected_output)
967
1028
def test_one_client(self):
968
1029
output = PrintTableCmd().output(self.one_client.values())