udata 10.1.4.dev34435__py2.py3-none-any.whl → 10.1.4.dev34522__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 (26) hide show
  1. udata/core/dataset/api.py +15 -1
  2. udata/harvest/tests/dcat/udata.xml +180 -0
  3. udata/harvest/tests/test_dcat_backend.py +65 -0
  4. udata/static/chunks/{10.471164b2a9fe15614797.js → 10.8ca60413647062717b1e.js} +3 -3
  5. udata/static/chunks/{10.471164b2a9fe15614797.js.map → 10.8ca60413647062717b1e.js.map} +1 -1
  6. udata/static/chunks/{11.51d706fb9521c16976bc.js → 11.b6f741fcc366abfad9c4.js} +3 -3
  7. udata/static/chunks/{11.51d706fb9521c16976bc.js.map → 11.b6f741fcc366abfad9c4.js.map} +1 -1
  8. udata/static/chunks/{13.f29411b06be1883356a3.js → 13.2d06442dd9a05d9777b5.js} +2 -2
  9. udata/static/chunks/{13.f29411b06be1883356a3.js.map → 13.2d06442dd9a05d9777b5.js.map} +1 -1
  10. udata/static/chunks/{17.3bd0340930d4a314ce9c.js → 17.e8e4caaad5cb0cc0bacc.js} +2 -2
  11. udata/static/chunks/{17.3bd0340930d4a314ce9c.js.map → 17.e8e4caaad5cb0cc0bacc.js.map} +1 -1
  12. udata/static/chunks/{19.8da42e8359d72afc2618.js → 19.f03a102365af4315f9db.js} +3 -3
  13. udata/static/chunks/{19.8da42e8359d72afc2618.js.map → 19.f03a102365af4315f9db.js.map} +1 -1
  14. udata/static/chunks/{8.54e44b102164ae5e7a67.js → 8.778091d55cd8ea39af6b.js} +2 -2
  15. udata/static/chunks/{8.54e44b102164ae5e7a67.js.map → 8.778091d55cd8ea39af6b.js.map} +1 -1
  16. udata/static/chunks/{9.07515e5187f475bce828.js → 9.033d7e190ca9e226a5d0.js} +3 -3
  17. udata/static/chunks/{9.07515e5187f475bce828.js.map → 9.033d7e190ca9e226a5d0.js.map} +1 -1
  18. udata/static/common.js +1 -1
  19. udata/static/common.js.map +1 -1
  20. udata/tests/api/test_datasets_api.py +49 -8
  21. {udata-10.1.4.dev34435.dist-info → udata-10.1.4.dev34522.dist-info}/METADATA +3 -1
  22. {udata-10.1.4.dev34435.dist-info → udata-10.1.4.dev34522.dist-info}/RECORD +26 -25
  23. {udata-10.1.4.dev34435.dist-info → udata-10.1.4.dev34522.dist-info}/LICENSE +0 -0
  24. {udata-10.1.4.dev34435.dist-info → udata-10.1.4.dev34522.dist-info}/WHEEL +0 -0
  25. {udata-10.1.4.dev34435.dist-info → udata-10.1.4.dev34522.dist-info}/entry_points.txt +0 -0
  26. {udata-10.1.4.dev34435.dist-info → udata-10.1.4.dev34522.dist-info}/top_level.txt +0 -0
udata/core/dataset/api.py CHANGED
@@ -402,7 +402,21 @@ class ResourcesAPI(API):
402
402
  def put(self, dataset):
403
403
  """Reorder resources"""
404
404
  ResourceEditPermission(dataset).test()
405
- data = {"resources": request.json}
405
+ resources = request.json
406
+ if len(dataset.resources) != len(resources):
407
+ api.abort(
408
+ 400,
409
+ f"All resources must be reordered, you provided {len(resources)} "
410
+ f"out of {len(dataset.resources)}",
411
+ )
412
+ if set(r["id"] if isinstance(r, dict) else r for r in resources) != set(
413
+ str(r.id) for r in dataset.resources
414
+ ):
415
+ api.abort(
416
+ 400,
417
+ f"Resource ids must match existing ones in dataset, ie: {set(str(r.id) for r in dataset.resources)}",
418
+ )
419
+ data = {"resources": resources}
406
420
  form = ResourcesListForm.from_json(
407
421
  data, obj=dataset, instance=dataset, meta={"csrf": False}
408
422
  )
@@ -0,0 +1,180 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rdf:RDF
3
+ xmlns:adms="http://www.w3.org/ns/adms#"
4
+ xmlns:dcat="http://www.w3.org/ns/dcat#"
5
+ xmlns:dct="http://purl.org/dc/terms/"
6
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
7
+ xmlns:hydra="http://www.w3.org/ns/hydra/core#"
8
+ xmlns:ns1="http://data.europa.eu/930/"
9
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
10
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
11
+ xmlns:skos="http://www.w3.org/2004/02/skos/core#"
12
+ xmlns:vcard="http://www.w3.org/2006/vcard/ns#"
13
+ >
14
+ <rdf:Description rdf:about="https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/">
15
+ <dct:identifier>https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/</dct:identifier>
16
+ <adms:identifier rdf:nodeID="N7cbef9d8b574438f86f859e81e04e4c0"/>
17
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Dataset"/>
18
+ <dct:title>Bureaux de vote - Vanves</dct:title>
19
+ <dct:description>La liste des 23 bureaux de vote à Vanves</dct:description>
20
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:issued>
21
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:modified>
22
+ <dcat:landingPage rdf:resource="https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/"/>
23
+ <dcat:keyword>administration-finances-publiques</dcat:keyword>
24
+ <dcat:keyword>bureaux-de-vote</dcat:keyword>
25
+ <dcat:keyword>elections</dcat:keyword>
26
+ <dcat:distribution rdf:resource="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-5dd4e0b2-4d96-4f36-b73e-b78ec993703c"/>
27
+ <dcat:distribution rdf:resource="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-0f80d285-72f8-49f8-a691-1dad6bd2f6db"/>
28
+ <dcat:distribution rdf:resource="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-d78d1245-6e8e-44d8-88cd-87b1dd66034f"/>
29
+ <dcat:distribution rdf:resource="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-b18fb2bd-6c8b-47a8-84fb-cdc8e29f4f1a"/>
30
+ <ns1:distributor rdf:resource="https://www.data.gouv.fr/organizations/54884a24c751df7226a3fc16/"/>
31
+ <dct:publisher rdf:resource="https://www.data.gouv.fr/api/1/contacts/67b7c3b0e2714e0e9de260a3/"/>
32
+ <dct:creator rdf:resource="https://www.data.gouv.fr/api/1/contacts/67b7c3b0e2714e0e9de260a4/"/>
33
+ </rdf:Description>
34
+ <rdf:Description rdf:about="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-5dd4e0b2-4d96-4f36-b73e-b78ec993703c">
35
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Distribution"/>
36
+ <dct:identifier>5dd4e0b2-4d96-4f36-b73e-b78ec993703c</dct:identifier>
37
+ <dct:title>bureau-de-vote-vanves.csv</dct:title>
38
+ <dct:description>Bureaux de vote - Vanves (csv)</dct:description>
39
+ <dcat:downloadURL rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/catalog/datasets/bureau-de-vote-vanves/exports/csv?use_labels=true"/>
40
+ <dcat:accessURL rdf:resource="https://www.data.gouv.fr/fr/datasets/r/5dd4e0b2-4d96-4f36-b73e-b78ec993703c"/>
41
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:issued>
42
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:modified>
43
+ <dct:rights>License Not Specified</dct:rights>
44
+ <dcat:mediaType>text/csv</dcat:mediaType>
45
+ <dct:format>csv</dct:format>
46
+ </rdf:Description>
47
+ <rdf:Description rdf:about="https://www.data.gouv.fr/api/1/organizations/54884a24c751df7226a3fc16/catalog">
48
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Catalog"/>
49
+ <rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#Collection"/>
50
+ <dct:publisher rdf:resource="https://www.data.gouv.fr/organizations/54884a24c751df7226a3fc16/"/>
51
+ <dct:title>Ville de Vanves</dct:title>
52
+ <dct:description>Ville de Vanves</dct:description>
53
+ <dcat:dataset rdf:resource="https://vanves-seineouest.opendatasoft.com/explore/dataset/vfe_public_219200755_20240506/"/>
54
+ <dcat:dataset rdf:resource="https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/"/>
55
+ <dcat:service rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/"/>
56
+ <hydra:totalItems rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</hydra:totalItems>
57
+ <hydra:view rdf:resource="https://www.data.gouv.fr/api/1/organizations/54884a24c751df7226a3fc16/catalog.rdf?page=1&amp;page_size=100"/>
58
+ </rdf:Description>
59
+ <rdf:Description rdf:about="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-d78d1245-6e8e-44d8-88cd-87b1dd66034f">
60
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Distribution"/>
61
+ <dct:identifier>d78d1245-6e8e-44d8-88cd-87b1dd66034f</dct:identifier>
62
+ <dct:title>bureau-de-vote-vanves.geojson</dct:title>
63
+ <dct:description>Bureaux de vote - Vanves (geojson)</dct:description>
64
+ <dcat:downloadURL rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/catalog/datasets/bureau-de-vote-vanves/exports/geojson"/>
65
+ <dcat:accessURL rdf:resource="https://www.data.gouv.fr/fr/datasets/r/d78d1245-6e8e-44d8-88cd-87b1dd66034f"/>
66
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:issued>
67
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:modified>
68
+ <dct:rights>License Not Specified</dct:rights>
69
+ <dcat:mediaType>application/json</dcat:mediaType>
70
+ <dct:format>json</dct:format>
71
+ </rdf:Description>
72
+ <rdf:Description rdf:about="https://www.data.gouv.fr/api/1/organizations/54884a24c751df7226a3fc16/catalog.rdf?page=1&amp;page_size=100">
73
+ <rdf:type rdf:resource="http://www.w3.org/ns/hydra/core#PartialCollectionView"/>
74
+ <hydra:first rdf:resource="https://www.data.gouv.fr/api/1/organizations/54884a24c751df7226a3fc16/catalog.rdf?page=1&amp;page_size=100"/>
75
+ <hydra:last rdf:resource="https://www.data.gouv.fr/api/1/organizations/54884a24c751df7226a3fc16/catalog.rdf?page=1&amp;page_size=100"/>
76
+ </rdf:Description>
77
+ <rdf:Description rdf:about="https://www.data.gouv.fr/organizations/54884a24c751df7226a3fc16/">
78
+ <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Organization"/>
79
+ <foaf:name>Ville de Vanves</foaf:name>
80
+ <rdfs:label>Ville de Vanves</rdfs:label>
81
+ <foaf:homepage rdf:resource="http://www.vanves.fr"/>
82
+ </rdf:Description>
83
+ <rdf:Description rdf:about="https://www.data.gouv.fr/datasets/66397176ff2a31840e29304c/#resource-482677b8-379c-45a5-83ef-0361fecb4cc3">
84
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Distribution"/>
85
+ <dct:identifier>482677b8-379c-45a5-83ef-0361fecb4cc3</dct:identifier>
86
+ <dct:title>vfe_public_219200755_20240506.json</dct:title>
87
+ <dct:description>Ville de Vanves - Part des véhicules à faibles émissions dans le renouvellement du parc (json)</dct:description>
88
+ <dcat:downloadURL rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/catalog/datasets/vfe_public_219200755_20240506/exports/json"/>
89
+ <dcat:accessURL rdf:resource="https://www.data.gouv.fr/fr/datasets/r/482677b8-379c-45a5-83ef-0361fecb4cc3"/>
90
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2024-05-06T15:15:18</dct:issued>
91
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2024-05-06T15:15:18</dct:modified>
92
+ <dct:rights>License Not Specified</dct:rights>
93
+ <dcat:mediaType>application/json</dcat:mediaType>
94
+ <dct:format>json</dct:format>
95
+ </rdf:Description>
96
+ <rdf:Description rdf:about="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-b18fb2bd-6c8b-47a8-84fb-cdc8e29f4f1a">
97
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Distribution"/>
98
+ <dct:identifier>b18fb2bd-6c8b-47a8-84fb-cdc8e29f4f1a</dct:identifier>
99
+ <dct:title>bureau-de-vote-vanves.zip</dct:title>
100
+ <dct:description>Bureaux de vote - Vanves (shp)</dct:description>
101
+ <dcat:downloadURL rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/catalog/datasets/bureau-de-vote-vanves/exports/shp"/>
102
+ <dcat:accessURL rdf:resource="https://www.data.gouv.fr/fr/datasets/r/b18fb2bd-6c8b-47a8-84fb-cdc8e29f4f1a"/>
103
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:issued>
104
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:modified>
105
+ <dct:rights>License Not Specified</dct:rights>
106
+ <dcat:mediaType>application/zip</dcat:mediaType>
107
+ <dct:format>zip</dct:format>
108
+ </rdf:Description>
109
+ <rdf:Description rdf:about="https://www.data.gouv.fr/datasets/66397176ff2a31840e29304c/#resource-aab4d337-a617-4c18-a045-291d68787a7d">
110
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Distribution"/>
111
+ <dct:identifier>aab4d337-a617-4c18-a045-291d68787a7d</dct:identifier>
112
+ <dct:title>vfe_public_219200755_20240506.csv</dct:title>
113
+ <dct:description>Ville de Vanves - Part des véhicules à faibles émissions dans le renouvellement du parc (csv)</dct:description>
114
+ <dcat:downloadURL rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/catalog/datasets/vfe_public_219200755_20240506/exports/csv?use_labels=true"/>
115
+ <dcat:accessURL rdf:resource="https://www.data.gouv.fr/fr/datasets/r/aab4d337-a617-4c18-a045-291d68787a7d"/>
116
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2024-05-06T15:15:18</dct:issued>
117
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2024-05-06T15:15:18</dct:modified>
118
+ <dct:rights>License Not Specified</dct:rights>
119
+ <dcat:mediaType>text/csv</dcat:mediaType>
120
+ <dct:format>csv</dct:format>
121
+ </rdf:Description>
122
+ <rdf:Description rdf:about="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/">
123
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#DataService"/>
124
+ <dct:identifier>https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/</dct:identifier>
125
+ <dct:title>Explore API v2 https://vanves-seineouest.opendatasoft.com</dct:title>
126
+ <dct:description></dct:description>
127
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2024-07-12T00:03:38.764000</dct:issued>
128
+ <dcat:endpointURL rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/"/>
129
+ <dcat:landingPage rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/console"/>
130
+ <dcat:endpointDescription rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/swagger.json"/>
131
+ <dcat:servesDataset rdf:resource="https://vanves-seineouest.opendatasoft.com/explore/dataset/vfe_public_219200755_20240506/"/>
132
+ <dcat:servesDataset rdf:resource="https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/"/>
133
+ </rdf:Description>
134
+ <rdf:Description rdf:nodeID="N25911b8ad0604e9f8de4d7e1965eb81a">
135
+ <rdf:type rdf:resource="http://www.w3.org/ns/adms#Identifier"/>
136
+ <dct:creator>data.gouv.fr</dct:creator>
137
+ <skos:notation>https://www.data.gouv.fr/datasets/66397176ff2a31840e29304c/</skos:notation>
138
+ </rdf:Description>
139
+ <rdf:Description rdf:about="https://vanves-seineouest.opendatasoft.com/explore/dataset/vfe_public_219200755_20240506/">
140
+ <dct:identifier>https://vanves-seineouest.opendatasoft.com/explore/dataset/vfe_public_219200755_20240506/</dct:identifier>
141
+ <adms:identifier rdf:nodeID="N25911b8ad0604e9f8de4d7e1965eb81a"/>
142
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Dataset"/>
143
+ <dct:title>Ville de Vanves - Part des véhicules à faibles émissions dans le renouvellement du parc</dct:title>
144
+ <dct:description>Ville de Vanves - Part des véhicules à faibles émissions dans le renouvellement du parc</dct:description>
145
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2024-05-06T15:15:18</dct:issued>
146
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2024-05-06T15:15:18</dct:modified>
147
+ <dcat:landingPage rdf:resource="https://vanves-seineouest.opendatasoft.com/explore/dataset/vfe_public_219200755_20240506/"/>
148
+ <dcat:distribution rdf:resource="https://www.data.gouv.fr/datasets/66397176ff2a31840e29304c/#resource-aab4d337-a617-4c18-a045-291d68787a7d"/>
149
+ <dcat:distribution rdf:resource="https://www.data.gouv.fr/datasets/66397176ff2a31840e29304c/#resource-482677b8-379c-45a5-83ef-0361fecb4cc3"/>
150
+ <ns1:distributor rdf:resource="https://www.data.gouv.fr/organizations/54884a24c751df7226a3fc16/"/>
151
+ <dct:publisher rdf:resource="https://www.data.gouv.fr/api/1/contacts/67b7c3b0e2714e0e9de260a3/"/>
152
+ <dct:creator rdf:resource="https://www.data.gouv.fr/api/1/contacts/67b7c3b0e2714e0e9de260a4/"/>
153
+ </rdf:Description>
154
+ <rdf:Description rdf:about="https://www.data.gouv.fr/api/1/contacts/67b7c3b0e2714e0e9de260a4/">
155
+ <rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Kind"/>
156
+ <vcard:fn>Vanves</vcard:fn>
157
+ </rdf:Description>
158
+ <rdf:Description rdf:about="https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/#resource-0f80d285-72f8-49f8-a691-1dad6bd2f6db">
159
+ <rdf:type rdf:resource="http://www.w3.org/ns/dcat#Distribution"/>
160
+ <dct:identifier>0f80d285-72f8-49f8-a691-1dad6bd2f6db</dct:identifier>
161
+ <dct:title>bureau-de-vote-vanves.json</dct:title>
162
+ <dct:description>Bureaux de vote - Vanves (json)</dct:description>
163
+ <dcat:downloadURL rdf:resource="https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/catalog/datasets/bureau-de-vote-vanves/exports/json"/>
164
+ <dcat:accessURL rdf:resource="https://www.data.gouv.fr/fr/datasets/r/0f80d285-72f8-49f8-a691-1dad6bd2f6db"/>
165
+ <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:issued>
166
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-04-19T12:21:56</dct:modified>
167
+ <dct:rights>License Not Specified</dct:rights>
168
+ <dcat:mediaType>application/json</dcat:mediaType>
169
+ <dct:format>json</dct:format>
170
+ </rdf:Description>
171
+ <rdf:Description rdf:about="https://www.data.gouv.fr/api/1/contacts/67b7c3b0e2714e0e9de260a3/">
172
+ <rdf:type rdf:resource="http://www.w3.org/2006/vcard/ns#Kind"/>
173
+ <vcard:fn>Vanves</vcard:fn>
174
+ </rdf:Description>
175
+ <rdf:Description rdf:nodeID="N7cbef9d8b574438f86f859e81e04e4c0">
176
+ <rdf:type rdf:resource="http://www.w3.org/ns/adms#Identifier"/>
177
+ <dct:creator>data.gouv.fr</dct:creator>
178
+ <skos:notation>https://www.data.gouv.fr/datasets/61892c9d076a4d62434a1318/</skos:notation>
179
+ </rdf:Description>
180
+ </rdf:RDF>
@@ -624,6 +624,71 @@ class DcatBackendTest:
624
624
  ) # noqa
625
625
  assert dataset.harvest.last_update.date() == date.today()
626
626
 
627
+ def test_udata_xml_catalog(self, rmock):
628
+ LicenseFactory(id="fr-lo", title="Licence ouverte / Open Licence")
629
+ url = mock_dcat(rmock, "udata.xml")
630
+ org = OrganizationFactory()
631
+ source = HarvestSourceFactory(backend="dcat", url=url, organization=org)
632
+ actions.run(source.slug)
633
+
634
+ source.reload()
635
+ job = source.get_last_job()
636
+ assert len(job.items) == 3
637
+
638
+ assert Dataset.objects.filter(organization=org).count() == 2
639
+ dataset = Dataset.objects.filter(organization=org, title="Bureaux de vote - Vanves").first()
640
+
641
+ assert dataset is not None
642
+ assert "bureaux-de-vote" in dataset.tags # support dcat:keyword
643
+ assert len(dataset.resources) == 4
644
+ assert dataset.description == "La liste des 23 bureaux de vote à Vanves"
645
+ assert dataset.harvest is not None
646
+ assert (
647
+ dataset.harvest.dct_identifier
648
+ == "https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/"
649
+ )
650
+ assert (
651
+ dataset.harvest.remote_id
652
+ == "https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/"
653
+ )
654
+ assert dataset.harvest.created_at.isoformat() == "2019-04-19T12:21:56"
655
+ assert dataset.harvest.modified_at.isoformat() == "2019-04-19T12:21:56"
656
+ assert (
657
+ dataset.harvest.uri
658
+ == "https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/"
659
+ )
660
+ assert (
661
+ dataset.harvest.remote_url
662
+ == "https://vanves-seineouest.opendatasoft.com/explore/dataset/bureau-de-vote-vanves/"
663
+ )
664
+ assert dataset.harvest.last_update.date() == date.today()
665
+
666
+ assert Dataservice.objects(organization=org).count() == 1
667
+ service = Dataservice.objects(organization=org).first()
668
+
669
+ assert service is not None
670
+ assert len(service.datasets) == 2
671
+ assert service.title == "Explore API v2 https://vanves-seineouest.opendatasoft.com"
672
+ assert service.description == ""
673
+ assert (
674
+ service.machine_documentation_url
675
+ == "https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/swagger.json"
676
+ )
677
+ assert (
678
+ service.base_api_url == "https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/"
679
+ )
680
+ assert service.harvest is not None
681
+ assert (
682
+ service.harvest.remote_id
683
+ == "https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/"
684
+ )
685
+ assert service.harvest.created_at.isoformat() == "2024-07-12T00:03:38.764000"
686
+ assert (
687
+ service.harvest.remote_url
688
+ == "https://vanves-seineouest.opendatasoft.com/api/explore/v2.1/console"
689
+ )
690
+ assert service.harvest.last_update.date() == date.today()
691
+
627
692
  def test_user_agent_get(self, rmock):
628
693
  url = mock_dcat(rmock, "catalog.xml", path="without/extension")
629
694
  rmock.head(url, headers={"Content-Type": "application/xml; charset=utf-8"})