diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 61fc5b6..d9f9abe 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -28,7 +28,12 @@ jobs: env: SECRET_KEY: 625a5459bc6e0d2e5227f9d7ec697c4a473f8697a84f5f7c8a run: | - poetry run python -m manage test + poetry run coverage -m manage test + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: dbchiro/DjangoSinpOrganisms # - name: Run test server # env: # SECRET_KEY: 625a5459bc6e0d2e5227f9d7ec697c4a473f8697a84f5f7c8a diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/initdata.json b/tests/initdata.json deleted file mode 100644 index 57b3cd1..0000000 --- a/tests/initdata.json +++ /dev/null @@ -1,867 +0,0 @@ -[ -{ - "model": "sinp_nomenclatures.type", - "fields": { - "timestamp_create": "2021-07-18T21:33:00.429Z", - "timestamp_update": "2021-07-18T21:33:00.429Z", - "code": "10", - "mnemonic": "organism_status", - "label": "organism_status", - "status": "VALID", - "create_date": "2021-07-18", - "update_date": "2021-07-18", - "source": null - } -}, -{ - "model": "sinp_nomenclatures.type", - "fields": { - "timestamp_create": "2021-07-18T21:33:00.429Z", - "timestamp_update": "2021-07-18T21:33:00.429Z", - "code": "11", - "mnemonic": "organism_type", - "label": "organism_type", - "status": "VALID", - "create_date": "2021-07-18", - "update_date": "2021-07-18", - "source": null - } -}, -{ - "model": "sinp_nomenclatures.type", - "fields": { - "timestamp_create": "2021-07-18T21:33:00.429Z", - "timestamp_update": "2021-07-18T21:33:00.429Z", - "code": "7", - "mnemonic": "geographic_area", - "label": "geographic_area", - "status": "VALID", - "create_date": "2021-07-18", - "update_date": "2021-07-18", - "source": null - } -}, -{ - "model": "sinp_nomenclatures.type", - "fields": { - "timestamp_create": "2021-07-18T21:33:00.429Z", - "timestamp_update": "2021-07-18T21:33:00.429Z", - "code": "1", - "mnemonic": "action_scope", - "label": "action_scope", - "status": "VALID", - "create_date": "2021-07-18", - "update_date": "2021-07-18", - "source": null - } -}, -{ - "model": "sinp_nomenclatures.type", - "fields": { - "timestamp_create": "2021-07-18T21:33:00.429Z", - "timestamp_update": "2021-07-18T21:33:00.429Z", - "code": "8", - "mnemonic": "member_level", - "label": "member_level", - "status": "VALID", - "create_date": "2021-07-18", - "update_date": "2021-07-18", - "source": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "11" - ], - "code": "admin", - "label": "Administration", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "11" - ], - "code": "assoc", - "label": "Association", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "11" - ], - "code": "privcomp", - "label": "Entreprise privée", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "11" - ], - "code": "indprivcomp", - "label": "Entreprise privée individuelle", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "11" - ], - "code": "pubestab", - "label": "Etablissement public", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "11" - ], - "code": "intstruc", - "label": "Structure interne", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "01", - "label": "Guadeloupe", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "02", - "label": "Martinique", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "03", - "label": "Guyane", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "04", - "label": "La Réunion", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "06", - "label": "Mayotte", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "11", - "label": "Île-de-France", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "21", - "label": "Champagne-Ardenne", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "22", - "label": "Picardie", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "23", - "label": "Haute-Normandie", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "24", - "label": "Centre-Val de Loire", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "25", - "label": "Basse-Normandie", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "26", - "label": "Bourgogne", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "27", - "label": "Bourgogne-Franche-Comté", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "28", - "label": "Normandie", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "31", - "label": "Nord-Pas-de-Calais", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "32", - "label": "Nord-Pas-de-Calais-Picardie", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "41", - "label": "Lorraine", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "42", - "label": "Alsace", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "43", - "label": "Franche-Comté", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "44", - "label": "Alsace-Champagne-Ardenne-Lorraine", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "52", - "label": "Pays de la Loire", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "53", - "label": "Bretagne", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "54", - "label": "Poitou-Charentes", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "72", - "label": "Aquitaine", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "73", - "label": "Midi-Pyrénées", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "74", - "label": "Limousin", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "75", - "label": "Aquitaine-Limousin-Poitou-Charentes", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "76", - "label": "Languedoc-Roussillon-Midi-Pyrénées", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "82", - "label": "Rhône-Alpes", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "83", - "label": "Auvergne", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "10" - ], - "code": "unk", - "label": "Inconnu", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "10" - ], - "code": "pub", - "label": "Public", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "10" - ], - "code": "priv", - "label": "Privé", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2023-12-30T23:06:19.216Z", - "timestamp_update": "2023-12-30T23:06:19.216Z", - "type": [ - "1" - ], - "code": "world", - "label": "Mondial", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2023-12-30T23:04:09.111Z", - "timestamp_update": "2023-12-30T23:04:09.111Z", - "type": [ - "11" - ], - "code": "regrp", - "label": "Regroupement d'organismes", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "84", - "label": "Auvergne-Rhône-Alpes", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "91", - "label": "Languedoc-Roussillon", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "93", - "label": "Provence-Alpes-Côte d'Azur", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "7" - ], - "code": "94", - "label": "Corse", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "1" - ], - "code": "eu", - "label": "Européen", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "1" - ], - "code": "nat", - "label": "national", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "1" - ], - "code": "supreg", - "label": "Supra régional", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "1" - ], - "code": "reg", - "label": "Régional", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "1" - ], - "code": "unknow", - "label": "Inconnu", - "description": "", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "8" - ], - "code": "manager", - "label": "Gestionnaire", - "description": "Permet la gestion des comptes et des métadonnées liés à ses organisme", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "8" - ], - "code": "validator", - "label": "Validateur", - "description": "Permet de valider les observations associées à son organisme", - "active": true, - "parent": null - } -}, -{ - "model": "sinp_nomenclatures.nomenclature", - "fields": { - "timestamp_create": "2021-07-18T21:37:00.239Z", - "timestamp_update": "2021-07-18T21:37:00.239Z", - "type": [ - "8" - ], - "code": "observer", - "label": "Observateur", - "description": "Permet de saisir des observations associées à son organisme", - "active": true, - "parent": null - } -} -] diff --git a/tests/test_organisms.py b/tests/test_organisms.py deleted file mode 100644 index 74f81c8..0000000 --- a/tests/test_organisms.py +++ /dev/null @@ -1,32 +0,0 @@ -import uuid - -from django.test import TestCase -from sinp_nomenclatures.models import Nomenclature - -from sinp_organisms.models import Organism - -org_uuid = uuid.uuid4() - - -class OrganismTestCase(TestCase): - fixtures = ["sinp_organisms/fixtures/nomenclatures.json"] - - def setUp(self): - Organism.objects.create( - uuid=org_uuid, - administrative_reference="18004417400019", - label="MUSEUM NATIONAL D'HISTOIRE NATURELLE", - short_label="MNHN", - action_scope=Nomenclature.objects.get( - type__mnemonic="action_scope", code="nat" - ), - status=Nomenclature.objects.get( - type__mnemonic="organism_status", code="pub" - ), - ) - - def organismExists(self): - """Animals that can speak are correctly identified""" - org1 = Organism.objects.get(uuid=org_uuid) - self.assertEqual(org1.short_label, "MNHN") - self.assertEqual(org1.natural_key(), (org_uuid,)) diff --git a/tests/test_settings.py b/tests/test_settings.py deleted file mode 100644 index 91c28f5..0000000 --- a/tests/test_settings.py +++ /dev/null @@ -1,10 +0,0 @@ -INSTALLED_APPS = [ - "organisms", -] -DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": ":memory:", - } -} -SECRET_KEY = "secret_key_for_testing"