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 ec85cd6..72c2aab 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 @@ -36,7 +36,11 @@ class TestVirtualFsBot(BotTestCase): ("", self.help_txt), ("pwd", "foo@example.com:\n/"), ("cd /home", "foo@example.com:\nERROR: invalid path"), + ("mkdir etc", "foo@example.com:\ndirectory created"), ("mkdir home", "foo@example.com:\ndirectory created"), ("cd /home", "foo@example.com:\nCurrent path: /home/"), + ("mkdir steve", "foo@example.com:\ndirectory created"), + ("rmdir /home", "foo@example.com:\nremoved"), + ("ls", "foo@example.com:\nERROR: file does not exist"), ] self.verify_dialog(expected) diff --git a/zulip_bots/zulip_bots/bots/virtual_fs/virtual_fs.py b/zulip_bots/zulip_bots/bots/virtual_fs/virtual_fs.py index 0e72a4d..35fe4fd 100644 --- a/zulip_bots/zulip_bots/bots/virtual_fs/virtual_fs.py +++ b/zulip_bots/zulip_bots/bots/virtual_fs/virtual_fs.py @@ -252,7 +252,7 @@ def fs_rmdir(fs: Dict[str, Any], user: str, fn: str) -> Tuple[Dict[str, Any], An new_fs.pop(path) directory = get_directory(path) new_fs[directory]['fns'].remove(path) - for sub_path in new_fs.keys(): + for sub_path in list(new_fs.keys()): if sub_path.startswith(path+'/'): new_fs.pop(sub_path) msg = 'removed'