diff --git a/arches_orm/graphql/resources.py b/arches_orm/graphql/resources.py index a546d15..36841cf 100644 --- a/arches_orm/graphql/resources.py +++ b/arches_orm/graphql/resources.py @@ -57,7 +57,7 @@ def __init__(self): self.related_nodes = {} def demap(self, model, field, value): - if value is None: + if value == None: # must be == not is, as we have an Empty concept type, for example. return None if (closure := self.demapped.get((model, field), None)): res = closure(value) @@ -152,6 +152,7 @@ def _construct_resource(vs, nodeid, field, model_name, datatype_instance): elif typ in (DataTypeNames.CONCEPT, DataTypeNames.CONCEPT_LIST): nodeid = info["nodeid"] collection = Concept().get_child_collections(models.Node.objects.get(nodeid=nodeid).config["rdmCollection"]) + print(collection) self.collections[nodeid] = { "forward": {f"{string_to_enum(field)}.{string_to_enum(label[1])}": label[2] for label in collection}, "back": {label[2]: string_to_enum(label[1]) for label in collection} diff --git a/tests/arches_django/fixtures.py b/tests/arches_django/fixtures.py new file mode 100644 index 0000000..f1fa11c --- /dev/null +++ b/tests/arches_django/fixtures.py @@ -0,0 +1,16 @@ +import pytest + +@pytest.fixture +def person_ash(arches_orm): + Person = arches_orm.models.Person + person = Person.create() + ash = person.name.append() + ash.full_name = "Ash" + return person + +@pytest.fixture +def person_ashs(arches_orm, person_ash): + person_ash.save() + yield person_ash + person_ash.delete() + diff --git a/tests/arches_django/test_arches_django.py b/tests/arches_django/test_arches_django.py index d2933f8..71a40f0 100644 --- a/tests/arches_django/test_arches_django.py +++ b/tests/arches_django/test_arches_django.py @@ -1,5 +1,6 @@ import pytest import json +from fixtures import person_ash, person_ashs JSON_PERSON = """ { @@ -55,20 +56,6 @@ """ -@pytest.fixture -def person_ash(arches_orm): - Person = arches_orm.models.Person - person = Person.create() - ash = person.name.append() - ash.full_name = "Ash" - return person - -@pytest.fixture -def person_ashs(arches_orm, person_ash): - person_ash.save() - yield person_ash - person_ash.delete() - @pytest.mark.django_db def test_can_save_with_name(arches_orm): Person = arches_orm.models.Person diff --git a/tests/arches_django/test_django_graphql.py b/tests/arches_django/test_django_graphql.py index 719f567..b859f41 100644 --- a/tests/arches_django/test_django_graphql.py +++ b/tests/arches_django/test_django_graphql.py @@ -8,6 +8,8 @@ import pytest_asyncio from django.contrib.auth.models import User +from fixtures import person_ash, person_ashs + @pytest.fixture def agc(): arches_graphql_client.config._CONFIGURATION["server"]