aboutsummaryrefslogtreecommitdiff
path: root/tests/test_collection.py
blob: 64dd293d5b694d4512b9cb5a4128cb8d2f511d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os.path
import shutil
import unittest

import lesana


class testCollectionLoading(unittest.TestCase):
    def tearDown(self):
        shutil.rmtree(os.path.join(self.collection.basedir, '.lesana'))

    def test_empty(self):
        self.collection = lesana.Collection('tests/data/empty')
        self.assertIsNone(self.collection.schema)
        self.assertIsNotNone(self.collection.cache)

    def test_simple(self):
        self.collection = lesana.Collection('tests/data/simple')
        self.assertIsNotNone(self.collection.schema)
        self.assertEqual(self.collection.schema['name'], "Simple lesana collection")
        self.assertEqual(len(self.collection.schema['fields']), 3)
        self.assertIsNotNone(self.collection.cache)