def start(self): self.add_tests() self.music_manipulation_tests() self.extractor_tests() self.queue_tests() self.shuffle_test() bot = run_dtest_bot(sys.argv, self.test_collector)
# This image is in WikiMedia Public Domain await interface.assert_reply_embed_equals("Test the Embed!", embed) @test_collector() async def test_embed_part_matches(interface): embed = Embed(title="Testing Title.", description="Wrong Description") await interface.assert_reply_embed_equals("Test the Part Embed!", embed, attributes_to_check=["title"]) @test_collector() async def test_reply_has_image(interface): await interface.assert_reply_has_image("Post something with an image!") @test_collector() async def test_reply_on_edit(interface): message = await interface.send_message("Say 'Yeah, that cool!'") await asyncio.sleep(1) await interface.edit_message(message, "Say 'Yeah, that is cool!'") await interface.assert_message_contains(message, "Yeah, that is cool!") # Actually run the bot if __name__ == "__main__": run_dtest_bot(sys.argv, test_collector)
import sys import distest collector = distest.TestCollector() @collector() async def test_one(interface: distest.TestInterface): await interface.send_message("$reload_extension TimeExtension") await interface.wait_for_message() await interface.send_message("$watch_channel") await interface.wait_for_message() await interface.send_message("4:20UTC") if __name__ == "__main__": distest.run_dtest_bot(sys.argv, collector)