536
536
help="Remove client")
537
537
parser.add_argument("-c", "--checker",
538
538
help="Set checker command for client")
539
parser.add_argument("-t", "--timeout",
539
parser.add_argument("-t", "--timeout", type=string_to_delta,
540
540
help="Set timeout for client")
541
parser.add_argument("--extended-timeout",
541
parser.add_argument("--extended-timeout", type=string_to_delta,
542
542
help="Set extended timeout for client")
543
parser.add_argument("-i", "--interval",
543
parser.add_argument("-i", "--interval", type=string_to_delta,
544
544
help="Set checker interval for client")
545
545
approve_deny_default = parser.add_mutually_exclusive_group()
546
546
approve_deny_default.add_argument(
551
551
"--deny-by-default", action="store_false",
552
552
dest="approved_by_default",
553
553
help="Set client to be denied by default")
554
parser.add_argument("--approval-delay",
554
parser.add_argument("--approval-delay", type=string_to_delta,
555
555
help="Set delay before client approve/deny")
556
parser.add_argument("--approval-duration",
556
parser.add_argument("--approval-duration", type=string_to_delta,
557
557
help="Set duration of one client approval")
558
558
parser.add_argument("-H", "--host", help="Set host for client")
559
559
parser.add_argument("-s", "--secret",
1100
1100
class TestSetTimeoutCmd(TestValueArgumentPropertyCmd):
1101
1101
command = SetTimeoutCmd
1102
1102
property = "Timeout"
1103
values_to_set = ["P0D", "PT5M", "PT1S", "PT120S", "P1Y"]
1104
values_to_get = [0, 300000, 1000, 120000, 31449600000]
1103
values_to_set = [datetime.timedelta(),
1104
datetime.timedelta(minutes=5),
1105
datetime.timedelta(seconds=1),
1106
datetime.timedelta(weeks=1),
1107
datetime.timedelta(weeks=52)]
1108
values_to_get = [0, 300000, 1000, 604800000, 31449600000]
1106
1110
class TestSetExtendedTimeoutCmd(TestValueArgumentPropertyCmd):
1107
1111
command = SetExtendedTimeoutCmd
1108
1112
property = "ExtendedTimeout"
1109
values_to_set = ["P0D", "PT5M", "PT1S", "PT120S", "P1Y"]
1110
values_to_get = [0, 300000, 1000, 120000, 31449600000]
1113
values_to_set = [datetime.timedelta(),
1114
datetime.timedelta(minutes=5),
1115
datetime.timedelta(seconds=1),
1116
datetime.timedelta(weeks=1),
1117
datetime.timedelta(weeks=52)]
1118
values_to_get = [0, 300000, 1000, 604800000, 31449600000]
1112
1120
class TestSetIntervalCmd(TestValueArgumentPropertyCmd):
1113
1121
command = SetIntervalCmd
1114
1122
property = "Interval"
1115
values_to_set = ["P0D", "PT5M", "PT1S", "PT120S", "P1Y"]
1116
values_to_get = [0, 300000, 1000, 120000, 31449600000]
1123
values_to_set = [datetime.timedelta(),
1124
datetime.timedelta(minutes=5),
1125
datetime.timedelta(seconds=1),
1126
datetime.timedelta(weeks=1),
1127
datetime.timedelta(weeks=52)]
1128
values_to_get = [0, 300000, 1000, 604800000, 31449600000]
1118
1130
class TestSetApprovalDelayCmd(TestValueArgumentPropertyCmd):
1119
1131
command = SetApprovalDelayCmd
1120
1132
property = "ApprovalDelay"
1121
values_to_set = ["P0D", "PT5M", "PT1S", "PT120S", "P1Y"]
1122
values_to_get = [0, 300000, 1000, 120000, 31449600000]
1133
values_to_set = [datetime.timedelta(),
1134
datetime.timedelta(minutes=5),
1135
datetime.timedelta(seconds=1),
1136
datetime.timedelta(weeks=1),
1137
datetime.timedelta(weeks=52)]
1138
values_to_get = [0, 300000, 1000, 604800000, 31449600000]
1124
1140
class TestSetApprovalDurationCmd(TestValueArgumentPropertyCmd):
1125
1141
command = SetApprovalDurationCmd
1126
1142
property = "ApprovalDuration"
1127
values_to_set = ["P0D", "PT5M", "PT1S", "PT120S", "P1Y"]
1128
values_to_get = [0, 300000, 1000, 120000, 31449600000]
1143
values_to_set = [datetime.timedelta(),
1144
datetime.timedelta(minutes=5),
1145
datetime.timedelta(seconds=1),
1146
datetime.timedelta(weeks=1),
1147
datetime.timedelta(weeks=52)]
1148
values_to_get = [0, 300000, 1000, 604800000, 31449600000]
1130
1150
class Test_command_from_options(unittest.TestCase):
1131
1151
def setUp(self):