diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_collection.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py index e97e912..eb57fb0 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -154,6 +154,38 @@ class testCollection(unittest.TestCase): self.assertIn('11189ee4: Another item', res) +class testSimpleCollection(unittest.TestCase): + def setUp(self): + self.tmpdir = tempfile.mkdtemp() + shutil.copytree('tests/data/simple', self.tmpdir, dirs_exist_ok=True) + self.collection = lesana.Collection(self.tmpdir) + + def tearDown(self): + shutil.rmtree(self.tmpdir) + + def test_update(self): + self.collection.update_field('Item', field="position", value="new_pos") + with open(os.path.join( + self.collection.basedir, + 'items', + '11189ee47ddf4796b718a483b379f976.yaml' + )) as fp: + self.assertIn("new_pos", fp.read()) + pass + self.assertEqual( + self.collection.entry_from_eid( + "11189ee47ddf4796b718a483b379f976" + ).data['position'], + "new_pos" + ) + + self.assertIsNone( + self.collection.entry_from_eid( + "8b69b063b2a64db7b5714294a69255c7" + ).data['position'] + ) + + class testEntries(unittest.TestCase): def setUp(self): self.collection = lesana.Collection('tests/data/simple') |