diff --git a/CHANGELOG.md b/CHANGELOG.md index a3fb12b079a2227fdc463dab05e588d54ae3d706..b2dfb4ebb5d6c3a80c3ea8655986f97192eb1582 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added (for new features) +* Test for [linkahead-pylib#123](https://gitlab.com/linkahead/linkahead-pylib/-/issues/123) * Tests for [linkahead-server#280](https://gitlab.com/linkahead/linkahead-server/-/issues/280) * Test for [caosdb-pylib#119](https://gitlab.com/linkahead/linkahead-pylib/-/issues/119) * Test for [caosdb-pylib#89](https://gitlab.com/linkahead/linkahead-pylib/-/issues/89) diff --git a/tests/test_issues_pylib.py b/tests/test_issues_pylib.py index 32b2bdb2e1e5a8bf514e27517f7edff6767e219b..1065428365b2a0955610febf3abc3e749b6aef86 100644 --- a/tests/test_issues_pylib.py +++ b/tests/test_issues_pylib.py @@ -196,3 +196,25 @@ def test_gitlab_com_120(): rt1_retrieved.update() # The update and addition of a new property must not change this, either. assert len(rt1_retrieved.get_property(rt2.name).properties) == 0 + + +def test_gitlab_com_123(): + """ + Test that Entity Role is taken into account when retrieving entities with + ambiguous name. + + See https://gitlab.com/linkahead/linkahead-pylib/-/issues/123. + """ + # Create ambiguous situation + db.RecordType(name="TestUniquenessRecordType").insert() + + f = db.File(file="__init__.py", path="__init__.py") + f.insert() + f.name = "TestUniquenessRecordType" + f.update(unique=False) + + # Check that only the file is retrieved and unique retrieve works + cont = db.File("TestUniquenessRecordType").retrieve(unique=False) + assert len(cont) == 1 + file = db.File("TestUniquenessRecordType").retrieve() + assert file.role == "File"