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.
- tasks/__init__.py +2 -2
- udata/__init__.py +1 -1
- udata/api/__init__.py +3 -2
- udata/api/commands.py +1 -0
- udata/api/fields.py +1 -22
- udata/api_fields.py +37 -140
- udata/app.py +1 -1
- udata/auth/__init__.py +12 -8
- udata/commands/db.py +3 -3
- udata/commands/dcat.py +1 -1
- udata/commands/fixtures.py +40 -60
- udata/commands/purge.py +1 -2
- udata/commands/tests/test_fixtures.py +11 -44
- udata/core/activity/api.py +1 -14
- udata/core/activity/tasks.py +1 -1
- udata/core/badges/models.py +2 -6
- udata/core/contact_point/api.py +3 -1
- udata/core/dataservices/api.py +1 -37
- udata/core/dataservices/models.py +0 -38
- udata/core/dataservices/tasks.py +1 -1
- udata/core/dataset/events.py +1 -4
- udata/core/dataset/forms.py +2 -0
- udata/core/dataset/models.py +10 -12
- udata/core/dataset/rdf.py +1 -1
- udata/core/discussions/api.py +1 -1
- udata/core/discussions/models.py +2 -2
- udata/core/discussions/tasks.py +1 -1
- udata/core/metrics/models.py +1 -4
- udata/core/organization/api.py +7 -11
- udata/core/organization/api_fields.py +4 -10
- udata/core/organization/apiv2.py +1 -1
- udata/core/organization/csv.py +0 -1
- udata/core/organization/rdf.py +1 -4
- udata/core/owned.py +2 -4
- udata/core/post/api.py +2 -2
- udata/core/reuse/api.py +25 -32
- udata/core/reuse/api_fields.py +101 -2
- udata/core/reuse/apiv2.py +4 -4
- udata/core/reuse/forms.py +45 -0
- udata/core/reuse/models.py +16 -98
- udata/core/site/api.py +29 -3
- udata/core/spatial/commands.py +3 -3
- udata/core/spatial/factories.py +1 -1
- udata/core/spatial/forms.py +1 -1
- udata/core/spatial/models.py +2 -2
- udata/core/spatial/tests/test_models.py +1 -1
- udata/core/spatial/translations.py +1 -3
- udata/core/topic/api.py +2 -2
- udata/core/topic/apiv2.py +2 -1
- udata/core/user/api.py +8 -28
- udata/core/user/metrics.py +1 -1
- udata/cors.py +4 -4
- udata/features/transfer/api.py +2 -1
- udata/harvest/actions.py +1 -1
- udata/harvest/backends/__init__.py +1 -1
- udata/harvest/tasks.py +1 -0
- udata/harvest/tests/factories.py +2 -0
- udata/harvest/tests/test_base_backend.py +1 -0
- udata/harvest/tests/test_dcat_backend.py +17 -16
- udata/migrations/2020-07-24-remove-s-from-scope-oauth.py +1 -1
- udata/migrations/2021-07-05-remove-unused-badges.py +1 -0
- udata/migrations/2023-02-08-rename-internal-dates.py +2 -0
- udata/migrations/2024-06-11-fix-reuse-datasets-references.py +1 -0
- udata/mongo/datetime_fields.py +4 -11
- udata/mongo/document.py +0 -2
- udata/mongo/taglist_field.py +0 -26
- udata/search/commands.py +1 -1
- udata/search/query.py +1 -1
- udata/settings.py +0 -1
- udata/static/admin.js +36 -36
- udata/static/admin.js.map +1 -1
- udata/static/chunks/{12.576e63b7a990f8eab784.js → 12.5b900cac4417e10ef3a0.js} +2 -2
- udata/static/chunks/12.5b900cac4417e10ef3a0.js.map +1 -0
- udata/static/chunks/{28.1ef31a46255dc2bf56d1.js → 28.1759a7f57d526e6db574.js} +2 -2
- udata/static/chunks/28.1759a7f57d526e6db574.js.map +1 -0
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- udata/tests/api/test_base_api.py +1 -1
- udata/tests/api/test_contact_points.py +4 -4
- udata/tests/api/test_dataservices_api.py +0 -59
- udata/tests/api/test_datasets_api.py +10 -10
- udata/tests/api/test_organizations_api.py +39 -39
- udata/tests/api/test_reuses_api.py +0 -49
- udata/tests/api/test_tags_api.py +4 -4
- udata/tests/api/test_transfer_api.py +1 -1
- udata/tests/api/test_user_api.py +0 -11
- udata/tests/apiv2/test_datasets.py +4 -4
- udata/tests/dataset/test_dataset_events.py +0 -28
- udata/tests/dataset/test_dataset_model.py +3 -3
- udata/tests/frontend/__init__.py +2 -0
- udata/tests/frontend/test_auth.py +1 -0
- udata/tests/organization/test_csv_adapter.py +2 -0
- udata/tests/organization/test_notifications.py +3 -3
- udata/tests/organization/test_organization_rdf.py +6 -31
- udata/tests/reuse/test_reuse_model.py +1 -0
- udata/tests/site/test_site_rdf.py +3 -1
- udata/tests/test_cors.py +3 -0
- udata/tests/test_owned.py +4 -4
- udata/tests/test_routing.py +1 -1
- udata/tests/test_tags.py +1 -1
- udata/tests/test_transfer.py +2 -1
- udata/tests/workers/test_jobs_commands.py +1 -1
- udata/utils.py +0 -12
- {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/METADATA +4 -16
- {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/RECORD +109 -109
- udata/static/chunks/12.576e63b7a990f8eab784.js.map +0 -1
- udata/static/chunks/28.1ef31a46255dc2bf56d1.js.map +0 -1
- udata/tests/api/test_activities_api.py +0 -69
- {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/LICENSE +0 -0
- {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/WHEEL +0 -0
- {udata-9.1.4.dist-info → udata-9.1.4.dev30973.dist-info}/entry_points.txt +0 -0
- {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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|