aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-12-28 18:21:19 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-12-28 18:21:19 +0100
commit812c47c4970ebebe19827d94fd467b9964028ae6 (patch)
tree2194c88c1c2cac03a63aaef2a6beba304c1fb531 /tests
parenta6e69a457226484f2419b792e45428041506e61d (diff)
Use eid instead of uid
Diffstat (limited to 'tests')
-rw-r--r--tests/data/complex/settings.yaml2
-rw-r--r--tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml2
-rw-r--r--tests/test_collection.py86
3 files changed, 45 insertions, 45 deletions
diff --git a/tests/data/complex/settings.yaml b/tests/data/complex/settings.yaml
index 03110f3..51f313f 100644
--- a/tests/data/complex/settings.yaml
+++ b/tests/data/complex/settings.yaml
@@ -1,6 +1,6 @@
name: "Fully featured lesana collection"
lang: 'english'
-entry_label: '{{ uid}}: {{ name }} ({{ tags }})'
+entry_label: '{{ eid }}: {{ name }} ({{ tags }})'
fields:
- name: name
type: string
diff --git a/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml b/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml
index 082128c..0abc78d 100644
--- a/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml
+++ b/tests/data/simple/items/085682ed-6792-499d-a3ab-9aebd683c011.yaml
@@ -3,4 +3,4 @@ description: |
This is a long block of text
that spans multiple lines.
position: somewhere
-uid: 085682ed6792499da3ab9aebd683c011
+eid: 085682ed6792499da3ab9aebd683c011
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 23186a1..b5266d9 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -104,31 +104,31 @@ class testCollection(unittest.TestCase):
for m in matches:
self.assertIsInstance(m, lesana.Entry)
- def test_entry_from_uid(self):
+ def test_entry_from_eid(self):
self.collection = lesana.Collection('tests/data/simple')
- entry = self.collection.entry_from_uid(
+ entry = self.collection.entry_from_eid(
'11189ee47ddf4796b718a483b379f976'
)
- self.assertEqual(entry.uid, '11189ee47ddf4796b718a483b379f976')
+ self.assertEqual(entry.eid, '11189ee47ddf4796b718a483b379f976')
self.collection.safe = True
- entry = self.collection.entry_from_uid(
+ entry = self.collection.entry_from_eid(
'11189ee47ddf4796b718a483b379f976'
)
- self.assertEqual(entry.uid, '11189ee47ddf4796b718a483b379f976')
+ self.assertEqual(entry.eid, '11189ee47ddf4796b718a483b379f976')
- def test_entry_from_short_uid(self):
+ def test_entry_from_short_eid(self):
self.collection = lesana.Collection('tests/data/simple')
- entries = self.collection.entries_from_short_uid(
+ entries = self.collection.entries_from_short_eid(
'11189ee4'
)
self.assertEqual(len(entries), 1)
- self.assertEqual(entries[0].uid, '11189ee47ddf4796b718a483b379f976')
- entries = self.collection.entries_from_short_uid(
+ self.assertEqual(entries[0].eid, '11189ee47ddf4796b718a483b379f976')
+ entries = self.collection.entries_from_short_eid(
'11189ee47ddf4796b718a483b379f976'
)
self.assertEqual(len(entries), 1)
- self.assertEqual(entries[0].uid, '11189ee47ddf4796b718a483b379f976')
- entries = self.collection.entries_from_short_uid(
+ self.assertEqual(entries[0].eid, '11189ee47ddf4796b718a483b379f976')
+ entries = self.collection.entries_from_short_eid(
'12345678'
)
self.assertEqual(len(entries), 0)
@@ -140,9 +140,9 @@ class testCollection(unittest.TestCase):
self.assertEqual(len(cm.output), 1)
self.assertIn("non_existing_file", cm.output[0])
- def test_get_entry_missing_uid(self):
+ def test_get_entry_missing_eid(self):
self.collection = lesana.Collection('tests/data/simple')
- entry = self.collection.entry_from_uid('this is not an uid')
+ entry = self.collection.entry_from_eid('this is not an eid')
self.assertIsNone(entry)
def test_render_collection(self):
@@ -170,14 +170,14 @@ class testEntries(unittest.TestCase):
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
- self.assertEqual(entry.idterm, 'Q'+data['uid'])
+ self.assertEqual(entry.idterm, 'Q'+data['eid'])
fname = '11189ee47ddf4796b718a483b379f976.yaml'
- uid = '11189ee47ddf4796b718a483b379f976'
+ eid = '11189ee47ddf4796b718a483b379f976'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
- self.assertEqual(entry.idterm, 'Q'+uid)
- self.assertEqual(entry.short_id, uid[:8])
+ self.assertEqual(entry.idterm, 'Q'+eid)
+ self.assertEqual(entry.short_id, eid[:8])
def test_write_new(self):
new_entry = lesana.Entry(self.collection)
@@ -194,71 +194,71 @@ class testEntries(unittest.TestCase):
self.assertIsInstance(written['name'], str)
def test_entry_representation(self):
- uid = '11189ee47ddf4796b718a483b379f976'
- entry = self.collection.entry_from_uid(uid)
+ eid = '11189ee47ddf4796b718a483b379f976'
+ entry = self.collection.entry_from_eid(eid)
self.assertEqual(
str(entry),
- uid
+ eid
)
- label = '{{ uid }}: {{ name }}'
+ label = '{{ eid }}: {{ name }}'
self.collection.settings['entry_label'] = label
self.assertEqual(
str(entry),
- '{uid}: {name}'.format(uid=uid, name='Another item')
+ '{eid}: {name}'.format(eid=eid, name='Another item')
)
- def test_entry_creation_uid_but_no_filename(self):
+ def test_entry_creation_eid_but_no_filename(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
- data['uid'] = '11189ee47ddf4796b718a483b379f976'
+ data['eid'] = '11189ee47ddf4796b718a483b379f976'
entry = lesana.Entry(self.collection, data=data)
self.assertEqual(entry.fname, fname)
- def test_entry_creation_no_uid_no_filename(self):
+ def test_entry_creation_no_eid_no_filename(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data)
- self.assertIsNotNone(entry.uid)
+ self.assertIsNotNone(entry.eid)
self.assertIsNotNone(entry.fname)
- def test_entry_creation_filename_but_no_uid(self):
+ def test_entry_creation_filename_but_no_eid(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
- uid = '11189ee47ddf4796b718a483b379f976'
+ eid = '11189ee47ddf4796b718a483b379f976'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data, fname=fname)
- self.assertEqual(entry.uid, uid)
+ self.assertEqual(entry.eid, eid)
- def test_entry_str_filename_and_uid(self):
+ def test_entry_str_filename_and_eid(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
- data['uid'] = '11189ee47ddf4796b718a483b379f976'
+ data['eid'] = '11189ee47ddf4796b718a483b379f976'
entry = lesana.Entry(self.collection, data=data)
- self.assertEqual(str(entry), data['uid'])
- self.collection.settings['entry_label'] = '{{ uid }}: {{ name }}'
- self.assertEqual(str(entry), data['uid'] + ': Another item')
+ self.assertEqual(str(entry), data['eid'])
+ self.collection.settings['entry_label'] = '{{ eid }}: {{ name }}'
+ self.assertEqual(str(entry), data['eid'] + ': Another item')
- def test_entry_str_filename_no_uid(self):
+ def test_entry_str_filename_no_eid(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data)
- uid = entry.uid
- self.assertEqual(str(entry), uid)
- self.collection.settings['entry_label'] = '{{ uid }}: {{ name }}'
- self.assertEqual(str(entry), uid + ': Another item')
+ eid = entry.eid
+ self.assertEqual(str(entry), eid)
+ self.collection.settings['entry_label'] = '{{ eid }}: {{ name }}'
+ self.assertEqual(str(entry), eid + ': Another item')
def test_render_entry(self):
fname = '11189ee47ddf4796b718a483b379f976.yaml'
with open(os.path.join(self.basepath, fname)) as fp:
data = ruamel.yaml.safe_load(fp)
entry = lesana.Entry(self.collection, data=data)
- uid = entry.uid
+ eid = entry.eid
res = entry.render('tests/data/simple/templates/trivial_template.txt')
- self.assertIn(uid, res)
+ self.assertIn(eid, res)
def test_empty_data(self):
entry = lesana.Entry(self.collection)
@@ -298,7 +298,7 @@ class testComplexCollection(unittest.TestCase):
self.assertIsInstance(m, lesana.Entry)
def test_boolean_field(self):
- entry = self.collection.entry_from_uid(
+ entry = self.collection.entry_from_eid(
'73097121f1874a6ea2f927db7dc4f11e'
)
self.assertIsInstance(entry.data['exists'], bool)
@@ -412,7 +412,7 @@ class testCollectionCreation(unittest.TestCase):
mset = collection._enquire.get_mset(0, 10)
self.assertEqual(mset.get_matches_estimated(), 0)
- def test_partial_uid_deletion(self):
+ def test_partial_eid_deletion(self):
tmpdir = tempfile.mkdtemp()
shutil.copy('tests/data/simple/settings.yaml', tmpdir)
shutil.copytree(