udata 9.1.4__py2.py3-none-any.whl → 9.1.4.dev30973__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of udata might be problematic. Click here for more details.

Files changed (112) hide show
  1. tasks/__init__.py +2 -2
  2. udata/__init__.py +1 -1
  3. udata/api/__init__.py +3 -2
  4. udata/api/commands.py +1 -0
  5. udata/api/fields.py +1 -22
  6. udata/api_fields.py +37 -140
  7. udata/app.py +1 -1
  8. udata/auth/__init__.py +12 -8
  9. udata/commands/db.py +3 -3
  10. udata/commands/dcat.py +1 -1
  11. udata/commands/fixtures.py +40 -60
  12. udata/commands/purge.py +1 -2
  13. udata/commands/tests/test_fixtures.py +11 -44
  14. udata/core/activity/api.py +1 -14
  15. udata/core/activity/tasks.py +1 -1
  16. udata/core/badges/models.py +2 -6
  17. udata/core/contact_point/api.py +3 -1
  18. udata/core/dataservices/api.py +1 -37
  19. udata/core/dataservices/models.py +0 -38
  20. udata/core/dataservices/tasks.py +1 -1
  21. udata/core/dataset/events.py +1 -4
  22. udata/core/dataset/forms.py +2 -0
  23. udata/core/dataset/models.py +10 -12
  24. udata/core/dataset/rdf.py +1 -1
  25. udata/core/discussions/api.py +1 -1
  26. udata/core/discussions/models.py +2 -2
  27. udata/core/discussions/tasks.py +1 -1
  28. udata/core/metrics/models.py +1 -4
  29. udata/core/organization/api.py +7 -11
  30. udata/core/organization/api_fields.py +4 -10
  31. udata/core/organization/apiv2.py +1 -1
  32. udata/core/organization/csv.py +0 -1
  33. udata/core/organization/rdf.py +1 -4
  34. udata/core/owned.py +2 -4
  35. udata/core/post/api.py +2 -2
  36. udata/core/reuse/api.py +25 -32
  37. udata/core/reuse/api_fields.py +101 -2
  38. udata/core/reuse/apiv2.py +4 -4
  39. udata/core/reuse/forms.py +45 -0
  40. udata/core/reuse/models.py +16 -98
  41. udata/core/site/api.py +29 -3
  42. udata/core/spatial/commands.py +3 -3
  43. udata/core/spatial/factories.py +1 -1
  44. udata/core/spatial/forms.py +1 -1
  45. udata/core/spatial/models.py +2 -2
  46. udata/core/spatial/tests/test_models.py +1 -1
  47. udata/core/spatial/translations.py +1 -3
  48. udata/core/topic/api.py +2 -2
  49. udata/core/topic/apiv2.py +2 -1
  50. udata/core/user/api.py +8 -28
  51. udata/core/user/metrics.py +1 -1
  52. udata/cors.py +4 -4
  53. udata/features/transfer/api.py +2 -1
  54. udata/harvest/actions.py +1 -1
  55. udata/harvest/backends/__init__.py +1 -1
  56. udata/harvest/tasks.py +1 -0
  57. udata/harvest/tests/factories.py +2 -0
  58. udata/harvest/tests/test_base_backend.py +1 -0
  59. udata/harvest/tests/test_dcat_backend.py +17 -16
  60. udata/migrations/2020-07-24-remove-s-from-scope-oauth.py +1 -1
  61. udata/migrations/2021-07-05-remove-unused-badges.py +1 -0
  62. udata/migrations/2023-02-08-rename-internal-dates.py +2 -0
  63. udata/migrations/2024-06-11-fix-reuse-datasets-references.py +1 -0
  64. udata/mongo/datetime_fields.py +4 -11
  65. udata/mongo/document.py +0 -2
  66. udata/mongo/taglist_field.py +0 -26
  67. udata/search/commands.py +1 -1
  68. udata/search/query.py +1 -1
  69. udata/settings.py +0 -1
  70. udata/static/admin.js +36 -36
  71. udata/static/admin.js.map +1 -1
  72. udata/static/chunks/{12.576e63b7a990f8eab784.js → 12.5b900cac4417e10ef3a0.js} +2 -2
  73. udata/static/chunks/12.5b900cac4417e10ef3a0.js.map +1 -0
  74. udata/static/chunks/{28.1ef31a46255dc2bf56d1.js → 28.1759a7f57d526e6db574.js} +2 -2
  75. udata/static/chunks/28.1759a7f57d526e6db574.js.map +1 -0
  76. udata/static/common.js +1 -1
  77. udata/static/common.js.map +1 -1
  78. udata/tests/api/test_base_api.py +1 -1
  79. udata/tests/api/test_contact_points.py +4 -4
  80. udata/tests/api/test_dataservices_api.py +0 -59
  81. udata/tests/api/test_datasets_api.py +10 -10
  82. udata/tests/api/test_organizations_api.py +39 -39
  83. udata/tests/api/test_reuses_api.py +0 -49
  84. udata/tests/api/test_tags_api.py +4 -4
  85. udata/tests/api/test_transfer_api.py +1 -1
  86. udata/tests/api/test_user_api.py +0 -11
  87. udata/tests/apiv2/test_datasets.py +4 -4
  88. udata/tests/dataset/test_dataset_events.py +0 -28
  89. udata/tests/dataset/test_dataset_model.py +3 -3
  90. udata/tests/frontend/__init__.py +2 -0
  91. udata/tests/frontend/test_auth.py +1 -0
  92. udata/tests/organization/test_csv_adapter.py +2 -0
  93. udata/tests/organization/test_notifications.py +3 -3
  94. udata/tests/organization/test_organization_rdf.py +6 -31
  95. udata/tests/reuse/test_reuse_model.py +1 -0
  96. udata/tests/site/test_site_rdf.py +3 -1
  97. udata/tests/test_cors.py +3 -0
  98. udata/tests/test_owned.py +4 -4
  99. udata/tests/test_routing.py +1 -1
  100. udata/tests/test_tags.py +1 -1
  101. udata/tests/test_transfer.py +2 -1
  102. udata/tests/workers/test_jobs_commands.py +1 -1
  103. udata/utils.py +0 -12
  104. {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/METADATA +4 -16
  105. {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/RECORD +109 -109
  106. udata/static/chunks/12.576e63b7a990f8eab784.js.map +0 -1
  107. udata/static/chunks/28.1ef31a46255dc2bf56d1.js.map +0 -1
  108. udata/tests/api/test_activities_api.py +0 -69
  109. {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/LICENSE +0 -0
  110. {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/WHEEL +0 -0
  111. {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/entry_points.txt +0 -0
  112. {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/top_level.txt +0 -0
@@ -1,69 +0,0 @@
1
- import pytest
2
- from flask import url_for
3
- from werkzeug.test import TestResponse
4
-
5
- from udata.core.activity.models import Activity
6
- from udata.core.dataset.factories import DatasetFactory
7
- from udata.core.dataset.models import Dataset
8
- from udata.core.reuse.factories import ReuseFactory
9
- from udata.core.reuse.models import Reuse
10
- from udata.core.user.factories import UserFactory
11
- from udata.mongo import db
12
- from udata.tests.helpers import assert200, assert400
13
-
14
- pytestmark = [
15
- pytest.mark.usefixtures("clean_db"),
16
- ]
17
-
18
-
19
- class FakeDatasetActivity(Activity):
20
- key = "fakeDataset"
21
- related_to = db.ReferenceField(Dataset, required=True)
22
-
23
-
24
- class FakeReuseActivity(Activity):
25
- key = "fakeReuse"
26
- related_to = db.ReferenceField(Reuse, required=True)
27
-
28
-
29
- class ActivityAPITest:
30
- modules = []
31
-
32
- def test_activity_api_list(self, api) -> None:
33
- """It should fetch an activity list from the API"""
34
- activities: list[Activity] = [
35
- FakeDatasetActivity.objects.create(actor=UserFactory(), related_to=DatasetFactory()),
36
- FakeReuseActivity.objects.create(actor=UserFactory(), related_to=ReuseFactory()),
37
- ]
38
-
39
- response: TestResponse = api.get(url_for("api.activity"))
40
- assert200(response)
41
- assert len(response.json["data"]) == len(activities)
42
-
43
- def test_activity_api_list_filter_by_bogus_related_to(self, api) -> None:
44
- """It should return a 400 error if the `related_to` parameter isn't a valid ObjectId."""
45
- response: TestResponse = api.get(url_for("api.activity", related_to="foobar"))
46
- assert400(response)
47
-
48
- def test_activity_api_list_filtered_by_related_to(self, api) -> None:
49
- """It should only return activities that correspond to the `related_to` parameter."""
50
- dataset1: Dataset = DatasetFactory()
51
- dataset2: Dataset = DatasetFactory()
52
- reuse: Reuse = ReuseFactory()
53
- _activities: list[Activity] = [
54
- FakeDatasetActivity.objects.create(actor=UserFactory(), related_to=dataset1),
55
- FakeDatasetActivity.objects.create(actor=UserFactory(), related_to=dataset1),
56
- FakeDatasetActivity.objects.create(actor=UserFactory(), related_to=dataset2),
57
- FakeReuseActivity.objects.create(actor=UserFactory(), related_to=reuse),
58
- ]
59
-
60
- response: TestResponse = api.get(url_for("api.activity", related_to=dataset1.id))
61
- assert200(response)
62
- len(response.json["data"]) == 2
63
- assert response.json["data"][0]["related_to"] == dataset1.title
64
- assert response.json["data"][1]["related_to"] == dataset1.title
65
-
66
- response: TestResponse = api.get(url_for("api.activity", related_to=reuse.id))
67
- assert200(response)
68
- len(response.json["data"]) == 1
69
- assert response.json["data"][0]["related_to"] == reuse.title