def test_output_base(self): response = cmd_roll.execute(self.cmd, self.uid, self.bot) expected = "That roll is not valid. Try `<@{}> roll help`".format( self.uid) assert response[0] == expected
def test_output_types_roll(self): dice = "1d20" cmd = "{} {}".format(self.cmd, dice) response = cmd_roll.execute(cmd, self.uid, self.bot) assert isinstance(response, tuple) assert response[0] is None assert isinstance(response[1], str)
def test_output_invalid_modifiers(self): modifiers = [".1", "&100", "PLUS ONE"] for mod in modifiers: cmd = "{} 1d20{}".format(self.cmd, mod) expected = "That roll is not valid. Try `<@{}> roll help`".format( self.uid) response = cmd_roll.execute(cmd, self.uid, self.bot) assert response[0] == expected
def test_output_invalid_number_of_sides(self): dice_pools = ["2d0", "2d1000"] for dice in dice_pools: cmd = "{} {}".format(self.cmd, dice) expected = "That roll is not valid. Try `<@{}> roll help`".format( self.uid) response = cmd_roll.execute(cmd, self.uid, self.bot) assert response[0] == expected
def test_output_roll_two_no_modifier(self): dice = "2d1" modifier = None rolls = [1, 1] total = 2 cmd = "{} {}{}".format(self.cmd, dice, modifier or "") response = cmd_roll.execute(cmd, self.uid, self.bot) expected = self.get_json_response(dice, total, rolls, modifier) assert response[1] == expected
def test_output_types_base(self): response = cmd_roll.execute(self.cmd, self.uid, self.bot) assert isinstance(response, tuple) assert isinstance(response[0], str) assert response[1] is None