From 9a7168c0262da9a2b4a6338a5179ce644a84fb15 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 2 Jan 2017 17:38:42 +0100 Subject: additional tests on init --- tests/test_collection.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/test_collection.py b/tests/test_collection.py index 9abb3f7..45c1efc 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -141,6 +141,13 @@ class testCollectionCreation(unittest.TestCase): self.assertTrue(os.path.isdir(os.path.join(tmpdir, '.lesana'))) self.assertTrue(os.path.isfile(os.path.join(tmpdir, 'settings.yaml'))) self.assertTrue(os.path.isfile(os.path.join(tmpdir, '.gitignore'))) + # and then run it twice on the same directory, nothing should break + collection = lesana.Collection.init(tmpdir) + self.assertIsInstance(collection, lesana.Collection) + self.assertTrue(os.path.isdir(os.path.join(tmpdir, '.git'))) + self.assertTrue(os.path.isdir(os.path.join(tmpdir, '.lesana'))) + self.assertTrue(os.path.isfile(os.path.join(tmpdir, 'settings.yaml'))) + self.assertTrue(os.path.isfile(os.path.join(tmpdir, '.gitignore'))) shutil.rmtree(tmpdir) def do_nothing(*args, **kwargs): @@ -164,4 +171,11 @@ class testCollectionCreation(unittest.TestCase): self.assertTrue(os.path.isdir(os.path.join(tmpdir, '.lesana'))) self.assertTrue(os.path.isfile(os.path.join(tmpdir, 'settings.yaml'))) self.assertFalse(os.path.isfile(os.path.join(tmpdir, '.gitignore'))) + # and then run it twice on the same directory, nothing should break + collection = lesana.Collection.init(tmpdir, git_enabled=False) + self.assertIsInstance(collection, lesana.Collection) + self.assertFalse(os.path.isdir(os.path.join(tmpdir, '.git'))) + self.assertTrue(os.path.isdir(os.path.join(tmpdir, '.lesana'))) + self.assertTrue(os.path.isfile(os.path.join(tmpdir, 'settings.yaml'))) + self.assertFalse(os.path.isfile(os.path.join(tmpdir, '.gitignore'))) shutil.rmtree(tmpdir) -- cgit v1.2.3