several updates to functionality
This commit is contained in:
27
tests/test_uid_mapping.py
Normal file
27
tests/test_uid_mapping.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import unittest
|
||||
|
||||
from validation import validate_uid_mapping
|
||||
|
||||
|
||||
class UidMappingTest(unittest.TestCase):
|
||||
def test_ambiguous_mapping_requires_ids(self) -> None:
|
||||
events = [
|
||||
{"title": "Event A"},
|
||||
{"title": "Event B"},
|
||||
]
|
||||
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
validate_uid_mapping(events, {"Event A"}, {2})
|
||||
|
||||
message = str(ctx.exception)
|
||||
self.assertIn("Ambivalent UID-mapping", message)
|
||||
self.assertIn("events[].id", message)
|
||||
|
||||
def test_ambiguous_mapping_with_ids_returns_false(self) -> None:
|
||||
events = [
|
||||
{"id": "log_01", "title": "Event A"},
|
||||
{"id": "log_02", "title": "Event B"},
|
||||
]
|
||||
|
||||
allow = validate_uid_mapping(events, {"Event A"}, {2})
|
||||
self.assertFalse(allow)
|
||||
Reference in New Issue
Block a user