954
954
def check_option_syntax(self, options):
955
955
check_option_syntax(self.parser, options)
957
def test_actions_conflicts_with_verbose(self):
958
for action, value in self.actions.items():
959
options = self.parser.parse_args()
960
setattr(options, action, value)
961
options.verbose = True
957
def test_actions_all_conflicts_with_verbose(self):
958
for action, value in self.actions.items():
959
options = self.parser.parse_args()
960
setattr(options, action, value)
962
options.verbose = True
963
with self.assertParseError():
964
self.check_option_syntax(options)
966
def test_actions_with_client_conflicts_with_verbose(self):
967
for action, value in self.actions.items():
968
options = self.parser.parse_args()
969
setattr(options, action, value)
970
options.verbose = True
971
options.client = ["foo"]
962
972
with self.assertParseError():
963
973
self.check_option_syntax(options)
990
1000
options.all = True
991
1001
self.check_option_syntax(options)
1003
def test_any_action_is_ok_with_one_client(self):
1004
for action, value in self.actions.items():
1005
options = self.parser.parse_args()
1006
setattr(options, action, value)
1007
options.client = ["foo"]
1008
self.check_option_syntax(options)
1010
def test_actions_except_is_enabled_are_ok_with_two_clients(self):
1011
for action, value in self.actions.items():
1012
if action == "is_enabled":
1014
options = self.parser.parse_args()
1015
setattr(options, action, value)
1016
options.client = ["foo", "barbar"]
1017
self.check_option_syntax(options)
993
1019
def test_is_enabled_fails_without_client(self):
994
1020
options = self.parser.parse_args()
995
1021
options.is_enabled = True
996
1022
with self.assertParseError():
997
1023
self.check_option_syntax(options)
999
def test_is_enabled_works_with_one_client(self):
1000
options = self.parser.parse_args()
1001
options.is_enabled = True
1002
options.client = ["foo"]
1003
self.check_option_syntax(options)
1005
1025
def test_is_enabled_fails_with_two_clients(self):
1006
1026
options = self.parser.parse_args()
1007
1027
options.is_enabled = True