async def test_soundboardCommand_sequential(command): prompt1 = bot.CommandPrompt(command, "Test UserName", True, None, None) result1 = await bot.processCommand(prompt1) assert result1 != None prompt2 = bot.CommandPrompt(command, "Test UserName", True, None, None) result2 = await bot.processCommand(prompt2) assert result2 != None
async def test_stopSoundboardCommand(): prompt1 = bot.CommandPrompt("/thiemo", "Test UserName", True, None, None) command1 = bot.processCommand(prompt1) prompt2 = bot.CommandPrompt("/stop", "Test UserName", True, None, None) result2 = await bot.processCommand(prompt2) result1 = await command1 assert result1 != None and result1.succeeded() and result2 != None
async def test_corruption(command, admin): prompt_corrupt = bot.CommandPrompt(command, "Test UserName", admin, None, None) result_corrupt = await bot.processCommand(prompt_corrupt) assert result_corrupt != None prompt_roll = bot.CommandPrompt("/roll 8", "Test UserName", admin, None, None) result_roll = await bot.processCommand(prompt_roll) assert result_roll != None
async def test_simpleReplies(command): prompt_admin = bot.CommandPrompt(command, "Test UserName", True, None, None) result_admin = await bot.processCommand(prompt_admin) assert result_admin != None prompt_user = bot.CommandPrompt(command, "Test UserName", False, None, None) result_user = await bot.processCommand(prompt_user) assert result_user != None
async def test_shutdown(command, admin): prompt = bot.CommandPrompt(command, "Test UserName", admin, None, None) if admin: with pytest.raises(SystemExit) as e: await bot.processCommand(prompt) assert e.type == SystemExit assert e.value.code == 0 else: result = await bot.processCommand(prompt) assert result != None
async def test_extend(command): prompt = bot.CommandPrompt(command, "Test UserName", True, None, None) result = await bot.processCommand(prompt) assert result != None
async def test_coinflip(): prompt = bot.CommandPrompt("/coinflip", "Test UserName", True, None, None) for i in range(100): result = await bot.processCommand(prompt) assert result != None
async def test_init(command): prompt = bot.CommandPrompt(command, "Test UserName", True, None, None) for i in range(100): result = await bot.processCommand(prompt) assert result != None
async def test_soundlist(): prompt = bot.CommandPrompt("/soundlist", "Test UserName", True, None, None) for i in range(100): result = await bot.processCommand(prompt) assert result != None
async def test_soundboardCommand(command, responseValid): prompt = bot.CommandPrompt("/thiemo", "Test UserName", True, None, None) result = await bot.processCommand(prompt) assert not responseValid or (result != None and result.succeeded() == True)
async def test_customCommands(command, response): prompt = bot.CommandPrompt(command, "Test UserName", False, None, None) result = await bot.processCommand(prompt) assert (result == None and response == None) or (result.message == response)
async def test_choose(command): prompt = bot.CommandPrompt(command, "Test UserName", False, None, None) result = await bot.processCommand(prompt) assert result != None
async def test_echoSoft(str, echo): prompt = bot.CommandPrompt("/echosoft " + str, "Test UserName", False, None, None) result = await bot.processCommand(prompt) assert result.message == echo
async def test_cleanup(command, admin): prompt = bot.CommandPrompt(command, "Test UserName", admin, None, None) result = await bot.processCommand(prompt) assert result != None