From 480c953b98ef7744f380c967de1b6b48aac28ac6 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Wed, 10 Jan 2018 16:03:33 -0500 Subject: [PATCH] virtual_fs: Add test_sample_conversation(). --- .../zulip_bots/bots/virtual_fs/test_virtual_fs.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zulip_bots/zulip_bots/bots/virtual_fs/test_virtual_fs.py b/zulip_bots/zulip_bots/bots/virtual_fs/test_virtual_fs.py index 2f619ba..e4baa86 100755 --- a/zulip_bots/zulip_bots/bots/virtual_fs/test_virtual_fs.py +++ b/zulip_bots/zulip_bots/bots/virtual_fs/test_virtual_fs.py @@ -1,4 +1,5 @@ from zulip_bots.test_lib import BotTestCase +from zulip_bots.bots.virtual_fs.virtual_fs import sample_conversation class TestVirtualFsBot(BotTestCase): bot_name = "virtual_fs" @@ -28,6 +29,18 @@ class TestVirtualFsBot(BotTestCase): frag = 'read home/stuff/file1\nERROR: file does not exist\n\n' self.assertIn(frag, content) + def test_sample_conversation(self) -> None: + # The function sample_conversation is actually part of the + # bot's implementation, because we render a sample conversation + # for the user's benefit if they ask. But then we can also + # use it to test that the bot works as advertised. + expected = [ + (request, 'foo@example.com:\n' + reply) + for (request, reply) + in sample_conversation() + ] + self.verify_dialog(expected) + def test_commands_1(self) -> None: expected = [ ("cd /home", "foo@example.com:\nERROR: invalid path"),