From e45c32956eb93be8fa55eba15a3a08919626528b Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Sat, 1 Feb 2020 18:42:13 +0100 Subject: [PATCH] Test: Reactivated and fixed some skipped tests. --- CHANGELOG.md | 2 ++ goblin/mapper.py | 5 +++-- tests/test_session.py | 5 ----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c83c92..7c33c3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## v2.2.3 +* Fixed bug when mapping an edge's properties introduced as a regression in newer gremlinpython versions. + ## v2.2.2 * updated to use aiobremlin v3.3.4 in order to get the correct dependency tree. diff --git a/goblin/mapper.py b/goblin/mapper.py index 15a3420..2d97e47 100644 --- a/goblin/mapper.py +++ b/goblin/mapper.py @@ -5,6 +5,7 @@ import functools import logging from goblin import exception +from gremlin_python.process.traversal import T logger = logging.getLogger(__name__) @@ -126,8 +127,8 @@ def map_vertex_property_to_ogm(result, element, *, mapping=None): def map_edge_to_ogm(result, props, element, *, mapping=None): """Map an edge returned by DB to OGM edge""" - props.pop('id') - label = props.pop('label') + props.pop(T.id) + label = props.pop(T.label) for db_name, value in props.items(): name, data_type = mapping.db_properties.get(db_name, (db_name, None)) if data_type: diff --git a/tests/test_session.py b/tests/test_session.py index 64207a6..273e871 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -112,7 +112,6 @@ class TestCreationApi: assert result is jon await app.close() - @pytest.mark.skip(reason="Test not working on all backends") @pytest.mark.asyncio async def test_get_edge(self, app, person_class, place_class, lives_in_class): @@ -187,7 +186,6 @@ class TestCreationApi: assert person is session1.current[rid] await app.close() - @pytest.mark.skip(reason="Test not working on all backends") @pytest.mark.asyncio async def test_remove_edge(self, app, person_class, place_class, lives_in_class): @@ -208,7 +206,6 @@ class TestCreationApi: assert not result await app.close() - @pytest.mark.skip(reason="Test not working on all backends") @pytest.mark.asyncio async def test_remove_edge_foreign_session(self, app, person_class, place_class, lives_in_class): @@ -249,7 +246,6 @@ class TestCreationApi: assert not result.age await app.close() - @pytest.mark.skip(reason="Test not working on all backends") #@pytest.mark.skipif(pytest.config.getoption('provider') == 'dse', reason='DSE') @pytest.mark.asyncio async def test_update_edge(self, app, person_class, knows): @@ -351,7 +347,6 @@ class TestTraversalApi: assert dave.__label__ == 'unregistered' await app.close() - @pytest.mark.skip(reason="Test not working on all backends") @pytest.mark.asyncio async def test_unregistered_edge_desialization(self, app): session = await app.session() -- GitLab