Exemple #1
0
    async def test_leave_when_no_message_xid(
        self,
        cog: LeaveGameCog,
        message: discord.Message,
        player: User,
    ) -> None:
        self.game.message_xid = None
        DatabaseSession.commit()

        with mock_operations(leave_action):
            leave_action.safe_fetch_text_channel.return_value = self.channel
            leave_action.safe_get_partial_message.return_value = message

            await self.run(cog.leave_command)

            leave_action.safe_send_channel.assert_called_once_with(
                self.interaction,
                "You have been removed from any games your were signed up for.",
                ephemeral=True,
            )
Exemple #2
0
 def player(self, user: User, game: Game) -> User:
     """Puts self.user into a game."""
     user.game = game
     DatabaseSession.commit()
     return user