From 573411b3d1248fb1bb8b58f4143dc223aea2cc85 Mon Sep 17 00:00:00 2001
From: Elena ``of Valhalla'' Grandi <valhalla@trueelena.org>
Date: Sat, 22 Apr 2017 19:18:41 +0200
Subject: Pass settings to Collection.init

---
 tests/test_collection.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'tests')

diff --git a/tests/test_collection.py b/tests/test_collection.py
index e17e044..bcd45e7 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -298,6 +298,25 @@ class testCollectionCreation(unittest.TestCase):
         self.assertTrue(self._find_file_in_git_index(fname, repo.index))
         shutil.rmtree(tmpdir)
 
+    def test_init_custom_settings(self):
+        tmpdir = tempfile.mkdtemp()
+        collection = lesana.Collection.init(
+            tmpdir,
+            edit_file=self.do_nothing,
+            settings={
+                'name': 'A different name',
+                'fields': [
+                    {'name': 'title', 'type': 'string'},
+                    {'name': 'author', 'type': 'string'},
+                    ],
+                },
+            )
+        self.assertIsInstance(collection, lesana.Collection)
+        self.assertTrue(os.path.isfile(os.path.join(tmpdir, 'settings.yaml')))
+        self.assertEqual(collection.settings['name'], 'A different name')
+        self.assertEqual(len(collection.settings['fields']), 2)
+        shutil.rmtree(tmpdir)
+
 
 if __name__ == '__main__':
     unittest.main()
-- 
cgit v1.2.3