def test_too_many_commands(self): self.command = {"roundlimit": 12, "fraglimit": 15} with self.assertRaises(TypeError) as ve: generate_cfg.construct_command_string(self.command, self.command_information, self.default_value) exception_raised = ve.exception self.assertIn("Too many commands", str(exception_raised))
def test_malformed_command_information(self): self.command_information = "Malformed" with self.assertRaises(TypeError) as ve: generate_cfg.construct_command_string(self.command, self.command_information, self.default_value) exception_raised = ve.exception self.assertEqual(str(exception_raised), "command_information has " "to be a dictionary")
def test_mbmode_no_map(self): self.command = {"mbmode": 0} self.command_information = self.mbmode_information self.default_value = {"map": "mb2_corellia", "mbmode": 0} with self.assertRaises(ValueError) as ve: generate_cfg.construct_command_string(self.command, self.command_information, self.default_value) exception_raised = ve.exception self.assertEqual(str(exception_raised), "mbmode needs a map")
def test_mbmode_bad_default_string(self): self.command = {"map": None, "mbmode": None} self.command_information = self.mbmode_information self.default_value = "mb2_corellia" with self.assertRaises(TypeError) as ve: generate_cfg.construct_command_string(self.command, self.command_information, self.default_value) exception_raised = ve.exception self.assertEqual(str(exception_raised), "mbmode defaults must be in a dictionary")
def test_mbmode_default_both(self): self.command = {"map": None, "mbmode": None} self.command_information = self.mbmode_information self.default_value = {"map": "mb2_corellia", "mbmode": 0} command_string = generate_cfg.construct_command_string( self.command, self.command_information, self.default_value) self.assertEqual(command_string, "mbmode 0 mb2_corellia")
def test_default_value(self): self.command = {"fraglimit": None} self.default_value = 15 command_string = generate_cfg.construct_command_string( self.command, self.command_information, self.default_value) self.assertEqual(command_string, "fraglimit 15")
def test_basic(self): command_string = generate_cfg.construct_command_string( self.command, self.command_information, self.default_value) self.assertEqual(command_string, "fraglimit 12")