diff --git a/contentcuration/contentcuration/models.py b/contentcuration/contentcuration/models.py index 8c772e46af..7fe911f14f 100644 --- a/contentcuration/contentcuration/models.py +++ b/contentcuration/contentcuration/models.py @@ -1490,14 +1490,14 @@ def get_details(self, channel_id=None): "resource_size": 0, "includes": {"coach_content": 0, "exercises": 0}, "kind_count": [], - "languages": "", - "accessible_languages": "", - "licenses": "", + "languages": [], + "accessible_languages": [], + "licenses": [], "tags": [], - "copyright_holders": "", - "authors": "", - "aggregators": "", - "providers": "", + "copyright_holders": [], + "authors": [], + "aggregators": [], + "providers": [], "sample_pathway": [], "original_channels": [], "sample_nodes": [], diff --git a/contentcuration/contentcuration/not_production_settings.py b/contentcuration/contentcuration/not_production_settings.py index 44c5da8bc5..e98410433d 100644 --- a/contentcuration/contentcuration/not_production_settings.py +++ b/contentcuration/contentcuration/not_production_settings.py @@ -1,5 +1,3 @@ -import logging - from .settings import * # noqa ALLOWED_HOSTS = ["studio.local", "192.168.31.9", "127.0.0.1", "*"] @@ -10,7 +8,6 @@ POSTMARK_TEST_MODE = True SITE_ID = 2 -logging.basicConfig(level="INFO") # Allow the debug() context processor to add variables to template context. # Include here the IPs from which a local dev server might be accessed. See diff --git a/contentcuration/contentcuration/tests/test_contentnodes.py b/contentcuration/contentcuration/tests/test_contentnodes.py index 25569f8988..dd12dcba45 100644 --- a/contentcuration/contentcuration/tests/test_contentnodes.py +++ b/contentcuration/contentcuration/tests/test_contentnodes.py @@ -184,10 +184,15 @@ def test_get_node_details(self): assert details["resource_count"] > 0 assert details["resource_size"] > 0 assert len(details["kind_count"]) > 0 - assert len(details["authors"]) == len([author for author in details["authors"] if author]) - assert len(details["aggregators"]) == len([aggregator for aggregator in details["aggregators"] if aggregator]) - assert len(details["providers"]) == len([provider for provider in details["providers"] if provider]) - assert len(details["copyright_holders"]) == len([holder for holder in details["copyright_holders"] if holder]) + + # assert format of list fields, including that they do not contain invalid data + list_fields = [ + "kind_count", "languages", "accessible_languages", "licenses", "tags", "original_channels", + "authors", "aggregators", "providers", "copyright_holders" + ] + for field in list_fields: + self.assertIsInstance(details.get(field), list, f"Field '{field}' isn't a list") + self.assertEqual(len(details[field]), len([value for value in details[field] if value]), f"List field '{field}' has falsy values") class NodeOperationsTestCase(StudioTestCase):