From bd5a6fe58cd739ea7d36cc9d37730adc4f688025 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Wed, 29 Dec 2021 10:17:11 +0100 Subject: Fix rm command test (and others) by indexing the collection at the beginning --- tests/test_commands.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'tests/test_commands.py') diff --git a/tests/test_commands.py b/tests/test_commands.py index 91a8894..2f3fa8c 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -47,6 +47,13 @@ class testCommandsSimple(unittest.TestCase, CommandsMixin): self.tmpdir.name, dirs_exist_ok=True, ) + # re-index the collection before running each test + args = { + 'collection': self.tmpdir.name, + "files": None, + "reset": True, + } + self._run_command(command.Index(), args) def tearDown(self): pass @@ -163,11 +170,20 @@ class testCommandsSimple(unittest.TestCase, CommandsMixin): args = { 'collection': self.tmpdir.name, 'git': True, - 'entries': '11189ee4', + 'entries': ['11189ee4'], } streams = self._run_command(command.Remove(), args) self.assertEqual(streams['stdout'].getvalue(), '') self.assertEqual(streams['stderr'].getvalue(), '') + # and check that the entry has been removed + args = { + 'collection': self.tmpdir.name, + 'git': True, + 'eid': '11189ee4', + 'template': False, + } + streams = self._run_command(command.Show(), args) + self.assertEqual(streams['stderr'].getvalue(), '') def test_update(self): args = { @@ -190,6 +206,13 @@ class testCommandsComplex(unittest.TestCase, CommandsMixin): self.tmpdir.name, dirs_exist_ok=True, ) + # re-index the collection before running each test + args = { + 'collection': self.tmpdir.name, + "files": None, + "reset": True, + } + self._run_command(command.Index(), args) def tearDown(self): pass -- cgit v1.2.3