From 849d334fceba3df65f294ad2ad58201a11d5175a Mon Sep 17 00:00:00 2001 From: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:22:06 +0100 Subject: [PATCH] [Fixes #6966] Thesauri intial data (#6967) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump urllib3 from 1.26.2 to 1.26.3 (#6908) Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.2 to 1.26.3. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/1.26.3/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.2...1.26.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Toni * [Fixes #6880] Circle CI upload tests fail irregulary (#6881) * [Fixes #6880] Circle CI upload tests fail irregulary * CircleCI test fix: sometimes expires due to upload timeout in the test environment * - Avoid infinite loop on upload testing * Revert "CircleCI test fix: sometimes expires due to upload timeout in the test environment" This reverts commit 66139fdbf0b7510a9829a3e01254f41782fb7e1d. Co-authored-by: Alessio Fabiani Co-authored-by: afabiani * [Fixes #6914] Remove "add to basket" tool for documents and maps (#6915) * Added malnajdi as contributor * [Fixes #6910] meaningful filename for document download (#6911) * get meaningful document filenames on download * - Strip extension from document title before slugify it (e.g.: image.jpg instead of imagejpg.jpg) Co-authored-by: afabiani Co-authored-by: Alessio Fabiani * - CircleCI Upload Tests: trying to reduce more the risk of infinite loop on "wait_for_progress" * [Fixes #6916] gsimporter.api.NotFound caused by missing trailing slash at the end of GEOSERVER_LOCATION (#6913) * [Fixes #6916] gsimporter.api.NotFound caused by missing trailing slash at the end of GEOSERVER_LOCATION * [Fixes #6916] unit test for GEOSERVER_LOCATION * Bump django-cors-headers from 3.6.0 to 3.7.0 (#6901) Bumps [django-cors-headers](https://github.com/adamchainz/django-cors-headers) from 3.6.0 to 3.7.0. - [Release notes](https://github.com/adamchainz/django-cors-headers/releases) - [Changelog](https://github.com/adamchainz/django-cors-headers/blob/master/HISTORY.rst) - [Commits](https://github.com/adamchainz/django-cors-headers/compare/3.6.0...3.7.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump amqp from 5.0.3 to 5.0.5 (#6905) Bumps [amqp](https://github.com/celery/py-amqp) from 5.0.3 to 5.0.5. - [Release notes](https://github.com/celery/py-amqp/releases) - [Changelog](https://github.com/celery/py-amqp/blob/master/Changelog) - [Commits](https://github.com/celery/py-amqp/compare/v5.0.3...v5.0.5) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pip from 21.0 to 21.0.1 (#6900) Bumps [pip](https://github.com/pypa/pip) from 21.0 to 21.0.1. - [Release notes](https://github.com/pypa/pip/releases) - [Changelog](https://github.com/pypa/pip/blob/master/NEWS.rst) - [Commits](https://github.com/pypa/pip/compare/21.0...21.0.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump coverage from 5.3.1 to 5.4 (#6903) Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.3.1 to 5.4. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.3.1...coverage-5.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pytest from 6.2.1 to 6.2.2 (#6907) Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.1 to 6.2.2. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.2.1...6.2.2) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump djangorestframework-gis from 0.16 to 0.17 (#6902) Bumps [djangorestframework-gis](https://github.com/openwisp/django-rest-framework-gis) from 0.16 to 0.17. - [Release notes](https://github.com/openwisp/django-rest-framework-gis/releases) - [Changelog](https://github.com/openwisp/django-rest-framework-gis/blob/master/CHANGES.rst) - [Commits](https://github.com/openwisp/django-rest-framework-gis/compare/v0.16.0...v0.17.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * - Algin setup.cfg to requirements.txt * [Fixes #6922][REST API v2] Expose the curated thumbnail URL if it has… (#6923) * [Fixes #6922][REST API v2] Expose the curated thumbnail URL if it has been uploaded * - Add REST APIs test suite to CircleCI * [Fixes #6918] Removal of QGIS support (#6919) * [Cleanup and Refactor] Remove QGIS server backend dependencies * [Cleanup and Refactor] Remove QGIS server backend dependencies * - Fix LGTM issues * allow Basic authenticated requests in LOCKDOWN mode * fix to avoid circular import * flake8 check fix * added tests * Fixes #6966: fix initial data for thesaurus, add custom data for test purposes, fix tests * Fixes #6966: fix flake8 syntax * Fixes #6966: thesaurus removed from initial_data.json Co-authored-by: Giovanni Allegri Co-authored-by: allyoucanmap Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Toni Co-authored-by: Alessio Fabiani Co-authored-by: afabiani Co-authored-by: Florian Hoedt Co-authored-by: Mohammed Y. Alnajdi Co-authored-by: biegan --- geonode/base/fields.py | 5 +- geonode/base/fixtures/initial_data.json | 266 +-------- geonode/base/fixtures/test_thesaurus.json | 638 ++++++++++++++++++++++ geonode/base/tests.py | 11 +- 4 files changed, 651 insertions(+), 269 deletions(-) create mode 100644 geonode/base/fixtures/test_thesaurus.json diff --git a/geonode/base/fields.py b/geonode/base/fields.py index 825f914bbcc..26de854ef97 100644 --- a/geonode/base/fields.py +++ b/geonode/base/fields.py @@ -20,6 +20,8 @@ from django import forms +from django.conf import settings + class MultiThesauriField(forms.ModelMultipleChoiceField): @@ -27,4 +29,5 @@ def label_from_instance(self, obj): # Note: Not using .get() because filter()[0] is used in original # code. The hard-coded language is currently used throughout # geonode. - return obj.keyword.filter(lang='en').first().label + lang = settings.THESAURUS_DEFAULT_LANG if hasattr(settings, "THESAURUS_DEFAULT_LANG") else "en" + return obj.keyword.filter(lang=lang).first().label diff --git a/geonode/base/fixtures/initial_data.json b/geonode/base/fixtures/initial_data.json index 564bf484af7..74c433f5de3 100644 --- a/geonode/base/fixtures/initial_data.json +++ b/geonode/base/fixtures/initial_data.json @@ -4852,269 +4852,5 @@ "fields": { "name": "TOPBAR_MENU" } - }, - { - "model": "base.thesaurus", - "pk": 1, - "fields": { - "identifier": "inspire_themes", - "title": "GEMET - INSPIRE themes, version 1.0", - "date": "2018-05-23T10:25:56", - "description": "GEMET - INSPIRE themes, version 1.0", - "slug": "", - "about": "http://inspire.ec.europa.eu/theme", - "card_min": 1, - "card_max": 0, - "facet": true - } - }, - { - "model": "base.thesaurus", - "pk": 4, - "fields": { - "identifier": "abc-all1", - "title": "Register of data of general interest", - "date": "2018-06-25", - "description": "Register of data of general interest", - "slug": "", - "about": "https://registry.geodati.gov.it/abc-all1", - "card_min": 0, - "card_max": 1, - "facet": true - } - }, - { - "model": "base.thesaurus", - "pk": 6, - "fields": { - "identifier": "limitation_on_public_access", - "title": "Limitations on public access", - "date": "2020-10-22T13:21:33", - "description": "Limitations on public access", - "slug": "", - "about": "http://inspire.ec.europa.eu/metadata-codelist/LimitationsOnPublicAccess", - "card_min": 1, - "card_max": 1, - "facet": true - } - }, - { - "model": "base.thesaurus", - "pk": 7, - "fields": { - "identifier": "limitation_on_public_access-2", - "title": "Conditions Applying To Access and Use", - "date": "2020-10-30T16:58:34", - "description": "Conditions Applying To Access and Use", - "slug": "", - "about": "http://inspire.ec.europa.eu/metadata-codelist/ConditionsApplyingToAccessAndUse", - "card_min": 0, - "card_max": -1, - "facet": true - } - }, - { - "model": "base.thesaurus", - "pk": 8, - "fields": { - "identifier": "foo_name", - "title": "Mocked Title", - "date": "2018-05-23T10:25:56", - "description": "Mocked Title", - "slug": "abc", - "about": "http://inspire.ec.europa.eu/theme", - "card_min": 1, - "card_max": -1, - "facet": true - } - }, - { - "model": "base.thesauruskeyword", - "pk": 1, - "fields": { - "about": "http://inspire.ec.europa.eu/theme/ad", - "alt_label": "ad", - "thesaurus": 1 - } - }, - { - "model": "base.thesauruskeyword", - "pk": 2, - "fields": { - "about": "http://inspire.ec.europa.eu/theme/au", - "alt_label": "au", - "thesaurus": 1 - } - }, - { - "model": "base.thesauruskeyword", - "pk": 3, - "fields": { - "about": "http://inspire.ec.europa.eu/theme/rs", - "alt_label": "rs", - "thesaurus": 1 - } - }, - { - "model": "base.thesauruskeyword", - "pk": 35, - "fields": { - "about": "http://inspire.ec.europa.eu/metadata-codelist/LimitationsOnPublicAccess/INSPIRE_Directive_Article13_1a", - "alt_label": "public access limited according to Article 13(1)(a) of the INSPIRE Directive [ITA]", - "thesaurus": 6 - } - }, - { - "model": "base.thesauruskeyword", - "pk": 44, - "fields": { - "about": "http://inspire.ec.europa.eu/metadata-codelist/ConditionsApplyingToAccessAndUse/noConditionsApply", - "alt_label": "No condition applicable", - "thesaurus": 7 - } - }, - { - "model": "base.thesauruskeyword", - "pk": 45, - "fields": { - "about": "http://inspire.ec.europa.eu/metadata-codelist/ConditionsApplyingToAccessAndUse/conditionsUnknown", - "alt_label": "Unknown Conditions", - "thesaurus": 7 - } - }, - { - "model": "base.thesauruskeyword", - "pk": 100, - "fields": { - "about": "http://test.com", - "alt_label": "Protected sites", - "thesaurus": 8 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 1, - "fields": { - "lang": "en", - "label": "Addresses", - "keyword": 1 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 2, - "fields": { - "lang": "de", - "label": "Adressen", - "keyword": 1 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 3, - "fields": { - "lang": "en", - "label": "Administrative units", - "keyword": 2 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 4, - "fields": { - "lang": "en", - "label": "Coordinate reference systems", - "keyword": 3 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 36, - "fields": { - "lang": "en", - "label": "public access limited according to Article 13(1)(a) of the INSPIRE Directive", - "keyword": 35 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 54, - "fields": { - "lang": "en", - "label": "no conditions to access and use", - "keyword": 44 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 56, - "fields": { - "lang": "en", - "label": "conditions to access and use unknown", - "keyword": 45 - } - }, - { - "model": "base.thesauruskeywordlabel", - "pk": 102, - "fields": { - "lang": "en", - "label": "Protected sites", - "keyword": 100 - } - }, - { - "model": "base.thesauruslabel", - "pk": 1, - "fields": { - "lang": "en", - "label": "Addresses", - "thesaurus": 1 - } - }, - { - "model": "base.thesauruslabel", - "pk": 2, - "fields": { - "lang": "de", - "label": "Adressen", - "thesaurus": 1 - } - }, - { - "model": "base.thesauruslabel", - "pk": 4, - "fields": { - "lang": "en", - "label": "Register of the reference data sets", - "thesaurus": 4 - } - }, - { - "model": "base.thesauruslabel", - "pk": 5, - "fields": { - "lang": "en", - "label": "Limitations on public access", - "thesaurus": 6 - } - }, - { - "model": "base.thesauruslabel", - "pk": 7, - "fields": { - "lang": "en", - "label": "Conditions Applying To Access and Use", - "thesaurus": 7 - } - }, - { - "model": "base.thesauruslabel", - "pk": 9, - "fields": { - "lang": "en", - "label": "Register of the reference data sets", - "thesaurus": 8 - } - } + } ] diff --git a/geonode/base/fixtures/test_thesaurus.json b/geonode/base/fixtures/test_thesaurus.json new file mode 100644 index 00000000000..f5436c1466a --- /dev/null +++ b/geonode/base/fixtures/test_thesaurus.json @@ -0,0 +1,638 @@ +[ + { + "model": "base.thesaurus", + "pk": 1, + "fields": { + "identifier": "inspire-theme", + "title": "GEMET - INSPIRE themes, version 1.0", + "date": "2018-05-23T10:25:56", + "description": "GEMET - INSPIRE themes, version 1.0", + "slug": "", + "about": "http://inspire.ec.europa.eu/theme", + "card_min": 1, + "card_max": 1, + "facet": true + } + }, + { + "model": "base.thesauruskeyword", + "pk": 1, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/ad", + "alt_label": "ad", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 2, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/au", + "alt_label": "au", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 3, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/rs", + "alt_label": "rs", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 4, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/gg", + "alt_label": "gg", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 5, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/cp", + "alt_label": "cp", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 6, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/gn", + "alt_label": "gn", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 7, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/hy", + "alt_label": "hy", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 8, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/ps", + "alt_label": "ps", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 9, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/tn", + "alt_label": "tn", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 10, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/el", + "alt_label": "el", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 11, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/ge", + "alt_label": "ge", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 12, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/lc", + "alt_label": "lc", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 13, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/oi", + "alt_label": "oi", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 14, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/af", + "alt_label": "af", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 15, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/am", + "alt_label": "am", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 16, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/ac", + "alt_label": "ac", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 17, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/br", + "alt_label": "br", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 18, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/bu", + "alt_label": "bu", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 19, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/er", + "alt_label": "er", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 20, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/ef", + "alt_label": "ef", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 21, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/hb", + "alt_label": "hb", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 22, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/hh", + "alt_label": "hh", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 23, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/lu", + "alt_label": "lu", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 24, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/mr", + "alt_label": "mr", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 25, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/nz", + "alt_label": "nz", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 26, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/of", + "alt_label": "of", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 27, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/pd", + "alt_label": "pd", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 28, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/pf", + "alt_label": "pf", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 29, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/sr", + "alt_label": "sr", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 30, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/so", + "alt_label": "so", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 31, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/sd", + "alt_label": "sd", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 32, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/su", + "alt_label": "su", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 34, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/us", + "alt_label": "us", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeyword", + "pk": 35, + "fields": { + "about": "http://inspire.ec.europa.eu/theme/mf", + "alt_label": "mf", + "thesaurus": 1 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 1, + "fields": { + "lang": "en", + "label": "Addresses", + "keyword": 1 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 2, + "fields": { + "lang": "de", + "label": "Adressen", + "keyword": 1 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 3, + "fields": { + "lang": "en", + "label": "Administrative units", + "keyword": 2 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 4, + "fields": { + "lang": "en", + "label": "Coordinate reference systems", + "keyword": 3 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 5, + "fields": { + "lang": "en", + "label": "Geographical grid systems", + "keyword": 4 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 6, + "fields": { + "lang": "en", + "label": "Cadastral parcels", + "keyword": 5 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 7, + "fields": { + "lang": "en", + "label": "Geographical names", + "keyword": 6 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 8, + "fields": { + "lang": "en", + "label": "Hydrography", + "keyword": 7 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 9, + "fields": { + "lang": "en", + "label": "Protected sites", + "keyword": 8 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 10, + "fields": { + "lang": "en", + "label": "Transport networks", + "keyword": 9 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 11, + "fields": { + "lang": "en", + "label": "Elevation", + "keyword": 10 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 12, + "fields": { + "lang": "en", + "label": "Geology", + "keyword": 11 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 13, + "fields": { + "lang": "en", + "label": "Land cover", + "keyword": 12 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 14, + "fields": { + "lang": "en", + "label": "Orthoimagery", + "keyword": 13 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 15, + "fields": { + "lang": "en", + "label": "Agricultural and aquaculture facilities", + "keyword": 14 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 16, + "fields": { + "lang": "en", + "label": "Area management/restriction/regulation zones and reporting units", + "keyword": 15 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 17, + "fields": { + "lang": "en", + "label": "Atmospheric conditions", + "keyword": 16 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 18, + "fields": { + "lang": "en", + "label": "Bio-geographical regions", + "keyword": 17 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 19, + "fields": { + "lang": "en", + "label": "Buildings", + "keyword": 18 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 20, + "fields": { + "lang": "en", + "label": "Energy resources", + "keyword": 19 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 21, + "fields": { + "lang": "en", + "label": "Environmental monitoring facilities", + "keyword": 20 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 22, + "fields": { + "lang": "en", + "label": "Habitats and biotopes", + "keyword": 21 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 23, + "fields": { + "lang": "en", + "label": "Human health and safety", + "keyword": 22 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 24, + "fields": { + "lang": "en", + "label": "Land use", + "keyword": 23 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 25, + "fields": { + "lang": "en", + "label": "Mineral resources", + "keyword": 24 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 26, + "fields": { + "lang": "en", + "label": "Natural risk zones", + "keyword": 25 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 27, + "fields": { + "lang": "en", + "label": "Oceanographic geographical features", + "keyword": 26 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 28, + "fields": { + "lang": "en", + "label": "Population distribution - demography", + "keyword": 27 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 29, + "fields": { + "lang": "en", + "label": "Production and industrial facilities", + "keyword": 28 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 30, + "fields": { + "lang": "en", + "label": "Sea regions", + "keyword": 29 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 31, + "fields": { + "lang": "en", + "label": "Soil", + "keyword": 30 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 32, + "fields": { + "lang": "en", + "label": "Species distribution", + "keyword": 31 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 33, + "fields": { + "lang": "en", + "label": "Statistical units", + "keyword": 32 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 34, + "fields": { + "lang": "en", + "label": "Utility and governmental services", + "keyword": 34 + } + }, + { + "model": "base.thesauruskeywordlabel", + "pk": 35, + "fields": { + "lang": "en", + "label": "Meteorological geographical features", + "keyword": 35 + } + } +] \ No newline at end of file diff --git a/geonode/base/tests.py b/geonode/base/tests.py index 2889e851928..33c6e83d79e 100644 --- a/geonode/base/tests.py +++ b/geonode/base/tests.py @@ -942,7 +942,12 @@ def __get_last_thesaurus(): return Thesaurus.objects.all().order_by("-id")[0] -class TestThesaurusAvailableForm(GeoNodeBaseTestSupport): +@override_settings(THESAURUS_DEFAULT_LANG="en") +class TestThesaurusAvailableForm(TestCase): + fixtures = [ + "test_thesaurus.json" + ] + def setUp(self): self.sut = ThesaurusAvailableForm @@ -951,9 +956,9 @@ def test_form_is_invalid_if_required_fields_are_missing(self): self.assertFalse(actual.is_valid()) def test_form_is_invalid_if_fileds_send_unexpected_values(self): - actual = self.sut(data={"8": [1, 2], "6": 1234}) + actual = self.sut(data={"1": [1, 2]}) self.assertFalse(actual.is_valid()) def test_form_is_valid_if_fileds_send_expected_values(self): - actual = self.sut(data={"8": [1, 2], "6": 36}) + actual = self.sut(data={"1": 1}) self.assertTrue(actual.is_valid())