umap-project 2.8.0a1__py3-none-any.whl → 2.8.0b0__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 umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/locale/en/LC_MESSAGES/django.po +13 -13
- umap/management/commands/empty_trash.py +5 -2
- umap/settings/local_s3.py +45 -0
- umap/static/umap/css/form.css +3 -0
- umap/static/umap/js/modules/data/features.js +12 -0
- umap/static/umap/js/modules/data/layer.js +37 -18
- umap/static/umap/js/modules/importer.js +65 -20
- umap/static/umap/js/modules/rendering/icon.js +2 -1
- umap/static/umap/js/modules/rendering/map.js +7 -7
- umap/static/umap/js/modules/rendering/ui.js +6 -2
- umap/static/umap/js/modules/request.js +2 -2
- umap/static/umap/js/modules/ui/dialog.js +5 -0
- umap/static/umap/js/modules/umap.js +32 -9
- umap/static/umap/js/umap.controls.js +7 -4
- umap/static/umap/js/umap.forms.js +44 -0
- umap/static/umap/locale/en.js +3 -1
- umap/static/umap/locale/en.json +3 -1
- umap/static/umap/locale/fr.js +3 -1
- umap/static/umap/locale/fr.json +3 -1
- umap/static/umap/map.css +34 -166
- umap/static/umap/vars.css +0 -1
- umap/templates/base.html +2 -0
- umap/templates/umap/components/alerts/alert.html +4 -0
- umap/templates/umap/css.html +3 -0
- umap/templates/umap/js.html +2 -0
- umap/templates/umap/map_init.html +2 -0
- umap/templates/umap/user_dashboard.html +2 -0
- umap/tests/fixtures/test_upload_simple_marker.json +19 -0
- umap/tests/integration/test_edit_datalayer.py +11 -0
- umap/tests/integration/test_import.py +20 -1
- umap/tests/test_dashboard.py +82 -0
- umap/tests/test_team_views.py +35 -1
- umap/tests/test_views.py +0 -74
- umap/views.py +20 -15
- {umap_project-2.8.0a1.dist-info → umap_project-2.8.0b0.dist-info}/METADATA +1 -1
- {umap_project-2.8.0a1.dist-info → umap_project-2.8.0b0.dist-info}/RECORD +40 -37
- {umap_project-2.8.0a1.dist-info → umap_project-2.8.0b0.dist-info}/WHEEL +0 -0
- {umap_project-2.8.0a1.dist-info → umap_project-2.8.0b0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.8.0a1.dist-info → umap_project-2.8.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -259,6 +259,35 @@ L.FormBuilder.CheckBox.include({
|
|
|
259
259
|
},
|
|
260
260
|
})
|
|
261
261
|
|
|
262
|
+
L.FormBuilder.EditableText = L.FormBuilder.Element.extend({
|
|
263
|
+
build: function () {
|
|
264
|
+
this.input = L.DomUtil.create('span', this.options.className || '', this.parentNode)
|
|
265
|
+
this.input.contentEditable = true
|
|
266
|
+
this.fetch()
|
|
267
|
+
L.DomEvent.on(this.input, 'input', this.sync, this)
|
|
268
|
+
L.DomEvent.on(this.input, 'keypress', this.onKeyPress, this)
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
getParentNode: function () {
|
|
272
|
+
return this.form
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
value: function () {
|
|
276
|
+
return this.input.textContent
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
fetch: function () {
|
|
280
|
+
this.input.textContent = this.toHTML()
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
onKeyPress: function (event) {
|
|
284
|
+
if (event.keyCode === 13) {
|
|
285
|
+
event.preventDefault()
|
|
286
|
+
this.input.blur()
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
})
|
|
290
|
+
|
|
262
291
|
L.FormBuilder.ColorPicker = L.FormBuilder.Input.extend({
|
|
263
292
|
colors: U.COLORS,
|
|
264
293
|
getParentNode: function () {
|
|
@@ -1192,6 +1221,21 @@ U.FormBuilder = L.FormBuilder.extend({
|
|
|
1192
1221
|
}
|
|
1193
1222
|
},
|
|
1194
1223
|
|
|
1224
|
+
getter: function (field) {
|
|
1225
|
+
const path = field.split('.')
|
|
1226
|
+
let value = this.obj
|
|
1227
|
+
let sub
|
|
1228
|
+
for (sub of path) {
|
|
1229
|
+
try {
|
|
1230
|
+
value = value[sub]
|
|
1231
|
+
} catch {
|
|
1232
|
+
console.log(field)
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
if (value === undefined) values = U.SCHEMA[sub]?.default
|
|
1236
|
+
return value
|
|
1237
|
+
},
|
|
1238
|
+
|
|
1195
1239
|
finish: (event) => {
|
|
1196
1240
|
event.helper?.input?.blur()
|
|
1197
1241
|
},
|
umap/static/umap/locale/en.js
CHANGED
|
@@ -520,7 +520,9 @@ const locale = {
|
|
|
520
520
|
"Import helpers": "Import helpers",
|
|
521
521
|
"Import helpers will fill the URL field for you.": "Import helpers will fill the URL field for you.",
|
|
522
522
|
"Wikipedia": "Wikipedia",
|
|
523
|
-
"Save draft": "Save draft"
|
|
523
|
+
"Save draft": "Save draft",
|
|
524
|
+
"No data has been found for import": "No data has been found for import",
|
|
525
|
+
"Successfully imported {count} feature(s)": "Successfully imported {count} feature(s)"
|
|
524
526
|
}
|
|
525
527
|
L.registerLocale("en", locale)
|
|
526
528
|
L.setLocale("en")
|
umap/static/umap/locale/en.json
CHANGED
|
@@ -520,5 +520,7 @@
|
|
|
520
520
|
"Import helpers": "Import helpers",
|
|
521
521
|
"Import helpers will fill the URL field for you.": "Import helpers will fill the URL field for you.",
|
|
522
522
|
"Wikipedia": "Wikipedia",
|
|
523
|
-
"Save draft": "Save draft"
|
|
523
|
+
"Save draft": "Save draft",
|
|
524
|
+
"No data has been found for import": "No data has been found for import",
|
|
525
|
+
"Successfully imported {count} feature(s)": "Successfully imported {count} feature(s)"
|
|
524
526
|
}
|
umap/static/umap/locale/fr.js
CHANGED
|
@@ -520,7 +520,9 @@ const locale = {
|
|
|
520
520
|
"Import helpers": "Assistants d'import",
|
|
521
521
|
"Import helpers will fill the URL field for you.": "Les assistants d'import vont renseigner le champ URL pour vous.",
|
|
522
522
|
"Wikipedia": "Wikipedia",
|
|
523
|
-
"Save draft": "Enregistrer le brouillon"
|
|
523
|
+
"Save draft": "Enregistrer le brouillon",
|
|
524
|
+
"No data has been found for import": "Aucunes données à importer",
|
|
525
|
+
"Successfully imported {count} feature(s)": "{count} élément(s) ajouté(s) à la carte"
|
|
524
526
|
}
|
|
525
527
|
L.registerLocale("fr", locale)
|
|
526
528
|
L.setLocale("fr")
|
umap/static/umap/locale/fr.json
CHANGED
|
@@ -520,5 +520,7 @@
|
|
|
520
520
|
"Import helpers": "Assistants d'import",
|
|
521
521
|
"Import helpers will fill the URL field for you.": "Les assistants d'import vont renseigner le champ URL pour vous.",
|
|
522
522
|
"Wikipedia": "Wikipedia",
|
|
523
|
-
"Save draft": "Enregistrer le brouillon"
|
|
523
|
+
"Save draft": "Enregistrer le brouillon",
|
|
524
|
+
"No data has been found for import": "Aucunes données à importer",
|
|
525
|
+
"Successfully imported {count} feature(s)": "{count} élément(s) ajouté(s) à la carte"
|
|
524
526
|
}
|
umap/static/umap/map.css
CHANGED
|
@@ -924,7 +924,6 @@ a.umap-control-caption,
|
|
|
924
924
|
width: 2px;
|
|
925
925
|
}
|
|
926
926
|
.umap-icon-active {
|
|
927
|
-
z-index: var(--zindex-icon-active)!important;
|
|
928
927
|
opacity: 1.0!important;
|
|
929
928
|
}
|
|
930
929
|
.umap-edit-enabled .readonly {
|
|
@@ -935,173 +934,42 @@ a.umap-control-caption,
|
|
|
935
934
|
/* ********************************* */
|
|
936
935
|
/* Ajax loader */
|
|
937
936
|
/* ********************************* */
|
|
938
|
-
.umap-loading .umap-loader
|
|
939
|
-
{
|
|
940
|
-
display: block;
|
|
941
|
-
-webkit-animation: shift-rightwards 3s ease-in-out infinite;
|
|
942
|
-
-moz-animation: shift-rightwards 3s ease-in-out infinite;
|
|
943
|
-
-ms-animation: shift-rightwards 3s ease-in-out infinite;
|
|
944
|
-
-o-animation: shift-rightwards 3s ease-in-out infinite;
|
|
945
|
-
animation: shift-rightwards 3s ease-in-out infinite;
|
|
946
|
-
-webkit-animation-delay: .2s;
|
|
947
|
-
-moz-animation-delay: .2s;
|
|
948
|
-
-o-animation-delay: .2s;
|
|
949
|
-
animation-delay: .2s;
|
|
950
|
-
}
|
|
951
937
|
.umap-loader {
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
60%
|
|
986
|
-
{
|
|
987
|
-
-webkit-transform:translateX(0%);
|
|
988
|
-
-moz-transform:translateX(0%);
|
|
989
|
-
-o-transform:translateX(0%);
|
|
990
|
-
transform:translateX(0%);
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
100%
|
|
994
|
-
{
|
|
995
|
-
-webkit-transform:translateX(100%);
|
|
996
|
-
-moz-transform:translateX(100%);
|
|
997
|
-
-o-transform:translateX(100%);
|
|
998
|
-
transform:translateX(100%);
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
}
|
|
1002
|
-
@-moz-keyframes shift-rightwards
|
|
1003
|
-
{
|
|
1004
|
-
0%
|
|
1005
|
-
{
|
|
1006
|
-
-webkit-transform:translateX(-100%);
|
|
1007
|
-
-moz-transform:translateX(-100%);
|
|
1008
|
-
-o-transform:translateX(-100%);
|
|
1009
|
-
transform:translateX(-100%);
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
40%
|
|
1013
|
-
{
|
|
1014
|
-
-webkit-transform:translateX(0%);
|
|
1015
|
-
-moz-transform:translateX(0%);
|
|
1016
|
-
-o-transform:translateX(0%);
|
|
1017
|
-
transform:translateX(0%);
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
60%
|
|
1021
|
-
{
|
|
1022
|
-
-webkit-transform:translateX(0%);
|
|
1023
|
-
-moz-transform:translateX(0%);
|
|
1024
|
-
-o-transform:translateX(0%);
|
|
1025
|
-
transform:translateX(0%);
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
100%
|
|
1029
|
-
{
|
|
1030
|
-
-webkit-transform:translateX(100%);
|
|
1031
|
-
-moz-transform:translateX(100%);
|
|
1032
|
-
-o-transform:translateX(100%);
|
|
1033
|
-
transform:translateX(100%);
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
}
|
|
1037
|
-
@-o-keyframes shift-rightwards
|
|
1038
|
-
{
|
|
1039
|
-
0%
|
|
1040
|
-
{
|
|
1041
|
-
-webkit-transform:translateX(-100%);
|
|
1042
|
-
-moz-transform:translateX(-100%);
|
|
1043
|
-
-o-transform:translateX(-100%);
|
|
1044
|
-
transform:translateX(-100%);
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
40%
|
|
1048
|
-
{
|
|
1049
|
-
-webkit-transform:translateX(0%);
|
|
1050
|
-
-moz-transform:translateX(0%);
|
|
1051
|
-
-o-transform:translateX(0%);
|
|
1052
|
-
transform:translateX(0%);
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
60%
|
|
1056
|
-
{
|
|
1057
|
-
-webkit-transform:translateX(0%);
|
|
1058
|
-
-moz-transform:translateX(0%);
|
|
1059
|
-
-o-transform:translateX(0%);
|
|
1060
|
-
transform:translateX(0%);
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
100%
|
|
1064
|
-
{
|
|
1065
|
-
-webkit-transform:translateX(100%);
|
|
1066
|
-
-moz-transform:translateX(100%);
|
|
1067
|
-
-o-transform:translateX(100%);
|
|
1068
|
-
transform:translateX(100%);
|
|
1069
|
-
}
|
|
1070
|
-
|
|
938
|
+
width: 100%;
|
|
939
|
+
height: 6px;
|
|
940
|
+
display: inline-block;
|
|
941
|
+
position: absolute;
|
|
942
|
+
background: var(--color-brightCyan);
|
|
943
|
+
overflow: hidden;
|
|
944
|
+
display: none;
|
|
945
|
+
top: 0;
|
|
946
|
+
left: 0;
|
|
947
|
+
right: 0;
|
|
948
|
+
height: 4px;
|
|
949
|
+
z-index: var(--zindex-loader);
|
|
950
|
+
}
|
|
951
|
+
.umap-loader::after {
|
|
952
|
+
content: '';
|
|
953
|
+
box-sizing: border-box;
|
|
954
|
+
width: 0;
|
|
955
|
+
height: 4.8px;
|
|
956
|
+
background: var(--color-darkerGray);
|
|
957
|
+
position: absolute;
|
|
958
|
+
top: 0;
|
|
959
|
+
left: 0;
|
|
960
|
+
animation: animFw 10s linear infinite;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
@keyframes animFw {
|
|
964
|
+
0% {
|
|
965
|
+
width: 0;
|
|
966
|
+
}
|
|
967
|
+
100% {
|
|
968
|
+
width: 100%;
|
|
969
|
+
}
|
|
1071
970
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
0%
|
|
1075
|
-
{
|
|
1076
|
-
-webkit-transform:translateX(-100%);
|
|
1077
|
-
-moz-transform:translateX(-100%);
|
|
1078
|
-
-o-transform:translateX(-100%);
|
|
1079
|
-
transform:translateX(-100%);
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
40%
|
|
1083
|
-
{
|
|
1084
|
-
-webkit-transform:translateX(0%);
|
|
1085
|
-
-moz-transform:translateX(0%);
|
|
1086
|
-
-o-transform:translateX(0%);
|
|
1087
|
-
transform:translateX(0%);
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
60%
|
|
1091
|
-
{
|
|
1092
|
-
-webkit-transform:translateX(0%);
|
|
1093
|
-
-moz-transform:translateX(0%);
|
|
1094
|
-
-o-transform:translateX(0%);
|
|
1095
|
-
transform:translateX(0%);
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
100%
|
|
1099
|
-
{
|
|
1100
|
-
-webkit-transform:translateX(100%);
|
|
1101
|
-
-moz-transform:translateX(100%);
|
|
1102
|
-
-o-transform:translateX(100%);
|
|
1103
|
-
transform:translateX(100%);
|
|
1104
|
-
}
|
|
971
|
+
.umap-loading .umap-loader {
|
|
972
|
+
display: block;
|
|
1105
973
|
}
|
|
1106
974
|
|
|
1107
975
|
/* *************************** */
|
umap/static/umap/vars.css
CHANGED
umap/templates/base.html
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
<meta name="viewport"
|
|
19
19
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
20
20
|
{# See https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs #}
|
|
21
|
+
{% autoescape off %}
|
|
21
22
|
<link rel="icon"
|
|
22
23
|
href="{% static 'umap/favicons/favicon.ico' %}"
|
|
23
24
|
sizes="32x32">
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
href="{% static 'umap/favicons/apple-touch-icon.png' %}">
|
|
29
30
|
<!-- 180×180 -->
|
|
30
31
|
<link rel="manifest" href="/manifest.webmanifest">
|
|
32
|
+
{% endautoescape %}
|
|
31
33
|
</head>
|
|
32
34
|
<body class="{% block body_class %}{% endblock body_class %}">
|
|
33
35
|
{% block header %}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{% load i18n static %}
|
|
2
2
|
|
|
3
|
+
{% autoescape off %}
|
|
3
4
|
<style type="text/css">
|
|
4
5
|
@import "{% static 'umap/js/components/alerts/alert.css' %}";
|
|
5
6
|
</style>
|
|
7
|
+
{% endautoescape %}
|
|
6
8
|
<template id="umap-alert-template">
|
|
7
9
|
<div role="dialog" class="dark window umap-alert">
|
|
8
10
|
<div>
|
|
@@ -97,6 +99,7 @@
|
|
|
97
99
|
</div>
|
|
98
100
|
</template>
|
|
99
101
|
<umap-alert-conflict></umap-alert-conflict>
|
|
102
|
+
{% autoescape off %}
|
|
100
103
|
<script type="module">
|
|
101
104
|
import { register } from '{% static 'umap/js/components/base.js' %}'
|
|
102
105
|
import {
|
|
@@ -108,3 +111,4 @@
|
|
|
108
111
|
register(uMapAlertCreation, 'umap-alert-creation')
|
|
109
112
|
register(uMapAlertConflict, 'umap-alert-conflict')
|
|
110
113
|
</script>
|
|
114
|
+
{% endautoescape %}
|
umap/templates/umap/css.html
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
{% load static %}
|
|
2
2
|
|
|
3
|
+
{% autoescape off %}
|
|
4
|
+
|
|
3
5
|
<link rel="stylesheet"
|
|
4
6
|
href="{% static 'umap/vendors/leaflet/leaflet.css' %}" />
|
|
5
7
|
<link rel="stylesheet"
|
|
@@ -39,3 +41,4 @@
|
|
|
39
41
|
<link rel="stylesheet" href="{% static 'umap/css/tableeditor.css' %}" />
|
|
40
42
|
<link rel="stylesheet" href="{% static 'umap/css/bar.css' %}" />
|
|
41
43
|
<link rel="stylesheet" href="{% static 'umap/theme.css' %}" />
|
|
44
|
+
{% endautoescape %}
|
umap/templates/umap/js.html
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{% load static %}
|
|
2
2
|
|
|
3
|
+
{% autoescape off %}
|
|
3
4
|
<script type="module"
|
|
4
5
|
src="{% static 'umap/vendors/leaflet/leaflet-src.esm.js' %}"
|
|
5
6
|
defer></script>
|
|
@@ -42,3 +43,4 @@
|
|
|
42
43
|
<script src="{% static 'umap/js/umap.forms.js' %}" defer></script>
|
|
43
44
|
<script src="{% static 'umap/js/umap.controls.js' %}" defer></script>
|
|
44
45
|
<script type="module" src="{% static 'umap/js/components/fragment.js' %}" defer></script>
|
|
46
|
+
{% endautoescape %}
|
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
{% block bottom_js %}
|
|
47
47
|
{{ block.super }}
|
|
48
48
|
<script type="module">
|
|
49
|
+
{% autoescape off %}
|
|
49
50
|
import Umap from '{% static "umap/js/modules/umap.js" %}'
|
|
51
|
+
{% endautoescape %}
|
|
50
52
|
const CACHE = {}
|
|
51
53
|
for (const mapOpener of document.querySelectorAll("button.map-opener")) {
|
|
52
54
|
mapOpener.addEventListener('click', (event) => {
|
|
@@ -221,3 +221,14 @@ def test_deleting_datalayer_should_remove_from_caption(
|
|
|
221
221
|
page.locator(".panel.right").get_by_title("Delete layer").click()
|
|
222
222
|
page.get_by_role("button", name="OK").click()
|
|
223
223
|
expect(panel.get_by_text("test datalayer")).to_be_hidden()
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def test_can_edit_datalayer_name_in_list(live_server, openmap, datalayer, page):
|
|
227
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
228
|
+
page.get_by_role("link", name="Manage layers").click()
|
|
229
|
+
page.get_by_text("test datalayer").click()
|
|
230
|
+
page.get_by_text("test datalayer").fill("test datalayer foobar")
|
|
231
|
+
page.get_by_role("button", name="Open browser").click()
|
|
232
|
+
expect(
|
|
233
|
+
page.locator(".panel.left").get_by_text("test datalayer foobar")
|
|
234
|
+
).to_be_visible()
|
|
@@ -9,7 +9,6 @@ from playwright.sync_api import expect
|
|
|
9
9
|
|
|
10
10
|
from umap.models import DataLayer
|
|
11
11
|
|
|
12
|
-
from ..base import mock_tiles
|
|
13
12
|
from .helpers import save_and_get_json
|
|
14
13
|
|
|
15
14
|
pytestmark = pytest.mark.django_db
|
|
@@ -765,3 +764,23 @@ def test_import_georss_from_textarea(tilelayer, live_server, page):
|
|
|
765
764
|
# A layer has been created
|
|
766
765
|
expect(layers).to_have_count(1)
|
|
767
766
|
expect(markers).to_have_count(1)
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
def test_import_from_multiple_files(live_server, page, tilelayer):
|
|
770
|
+
page.goto(f"{live_server.url}/map/new/")
|
|
771
|
+
page.get_by_title("Import data").click()
|
|
772
|
+
file_input = page.locator("input[type='file']")
|
|
773
|
+
with page.expect_file_chooser() as fc_info:
|
|
774
|
+
file_input.click()
|
|
775
|
+
file_chooser = fc_info.value
|
|
776
|
+
FIXTURES = Path(__file__).parent.parent / "fixtures"
|
|
777
|
+
paths = [
|
|
778
|
+
FIXTURES / "test_upload_data.json",
|
|
779
|
+
FIXTURES / "test_upload_simple_marker.json",
|
|
780
|
+
]
|
|
781
|
+
file_chooser.set_files(paths)
|
|
782
|
+
markers = page.locator(".leaflet-marker-icon")
|
|
783
|
+
expect(markers).to_have_count(0)
|
|
784
|
+
page.get_by_role("button", name="Import data", exact=True).click()
|
|
785
|
+
# Two in one file, one in the other
|
|
786
|
+
expect(markers).to_have_count(3)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from django.contrib.auth import get_user_model
|
|
3
|
+
from django.urls import reverse
|
|
4
|
+
|
|
5
|
+
from umap.models import Map
|
|
6
|
+
|
|
7
|
+
from .base import MapFactory, UserFactory
|
|
8
|
+
|
|
9
|
+
User = get_user_model()
|
|
10
|
+
|
|
11
|
+
pytestmark = pytest.mark.django_db
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_user_dashboard_is_restricted_to_logged_in(client):
|
|
15
|
+
response = client.get(reverse("user_dashboard"))
|
|
16
|
+
assert response.status_code == 302
|
|
17
|
+
assert response["Location"] == "/en/login/?next=/en/me"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_user_dashboard_display_user_maps(client, map):
|
|
21
|
+
client.login(username=map.owner.username, password="123123")
|
|
22
|
+
response = client.get(reverse("user_dashboard"))
|
|
23
|
+
assert response.status_code == 200
|
|
24
|
+
body = response.content.decode()
|
|
25
|
+
assert map.name in body
|
|
26
|
+
assert f"{map.get_absolute_url()}?edit" in body
|
|
27
|
+
assert f"{map.get_absolute_url()}?share" in body
|
|
28
|
+
assert f"/map/{map.pk}/download" in body
|
|
29
|
+
assert "Everyone (public)" in body
|
|
30
|
+
assert "Owner only" in body
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_user_dashboard_do_not_display_blocked_user_maps(client, map):
|
|
34
|
+
map.share_status = Map.BLOCKED
|
|
35
|
+
map.save()
|
|
36
|
+
client.login(username=map.owner.username, password="123123")
|
|
37
|
+
response = client.get(reverse("user_dashboard"))
|
|
38
|
+
assert response.status_code == 200
|
|
39
|
+
body = response.content.decode()
|
|
40
|
+
assert map.name not in body
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_user_dashboard_do_not_display_deleted_user_maps(client, map):
|
|
44
|
+
map.share_status = Map.DELETED
|
|
45
|
+
map.save()
|
|
46
|
+
client.login(username=map.owner.username, password="123123")
|
|
47
|
+
response = client.get(reverse("user_dashboard"))
|
|
48
|
+
assert response.status_code == 200
|
|
49
|
+
body = response.content.decode()
|
|
50
|
+
assert map.name not in body
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@pytest.mark.parametrize("share_status", [Map.DRAFT, Map.PRIVATE, Map.PUBLIC, Map.OPEN])
|
|
54
|
+
def test_user_dashboard_display_user_team_maps(client, map, team, user, share_status):
|
|
55
|
+
user.teams.add(team)
|
|
56
|
+
user.save()
|
|
57
|
+
map.team = team
|
|
58
|
+
map.share_status = share_status
|
|
59
|
+
map.save()
|
|
60
|
+
assert map.owner != user
|
|
61
|
+
client.login(username=user.username, password="123123")
|
|
62
|
+
response = client.get(reverse("user_dashboard"))
|
|
63
|
+
assert response.status_code == 200
|
|
64
|
+
body = response.content.decode()
|
|
65
|
+
assert map.name in body
|
|
66
|
+
assert map.get_absolute_url() in body
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_user_dashboard_display_user_maps_distinct(client, map):
|
|
70
|
+
# cf https://github.com/umap-project/umap/issues/1325
|
|
71
|
+
anonymap = MapFactory(name="Map witout owner should not appear")
|
|
72
|
+
user1 = UserFactory(username="user1")
|
|
73
|
+
user2 = UserFactory(username="user2")
|
|
74
|
+
map.editors.add(user1)
|
|
75
|
+
map.editors.add(user2)
|
|
76
|
+
map.save()
|
|
77
|
+
client.login(username=map.owner.username, password="123123")
|
|
78
|
+
response = client.get(reverse("user_dashboard"))
|
|
79
|
+
assert response.status_code == 200
|
|
80
|
+
body = response.content.decode()
|
|
81
|
+
assert body.count(f'<a href="/en/map/test-map_{map.pk}">test map</a>') == 1
|
|
82
|
+
assert body.count(anonymap.name) == 0
|
umap/tests/test_team_views.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
from django.urls import reverse
|
|
3
3
|
|
|
4
|
-
from umap.models import Team
|
|
4
|
+
from umap.models import Map, Team
|
|
5
5
|
|
|
6
6
|
pytestmark = pytest.mark.django_db
|
|
7
7
|
|
|
@@ -15,6 +15,40 @@ def test_can_see_team_maps(client, map, team):
|
|
|
15
15
|
assert map.name in response.content.decode()
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
@pytest.mark.parametrize("share_status", [Map.PRIVATE, Map.DRAFT])
|
|
19
|
+
def test_others_cannot_see_team_private_maps_in_team_page(
|
|
20
|
+
client, map, team, user, share_status
|
|
21
|
+
):
|
|
22
|
+
map.team = team
|
|
23
|
+
map.share_status = share_status
|
|
24
|
+
map.save()
|
|
25
|
+
url = reverse("team_maps", args=(team.pk,))
|
|
26
|
+
response = client.get(url)
|
|
27
|
+
assert response.status_code == 200
|
|
28
|
+
assert map.name not in response.content.decode()
|
|
29
|
+
# User is not in team
|
|
30
|
+
client.login(username=user.username, password="123123")
|
|
31
|
+
response = client.get(url)
|
|
32
|
+
assert response.status_code == 200
|
|
33
|
+
assert map.name not in response.content.decode()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.mark.parametrize("share_status", [Map.PRIVATE, Map.DRAFT])
|
|
37
|
+
def test_members_can_see_private_maps_in_team_page(
|
|
38
|
+
client, map, team, user, share_status
|
|
39
|
+
):
|
|
40
|
+
map.team = team
|
|
41
|
+
map.share_status = share_status
|
|
42
|
+
map.save()
|
|
43
|
+
user.teams.add(team)
|
|
44
|
+
user.save()
|
|
45
|
+
url = reverse("team_maps", args=(team.pk,))
|
|
46
|
+
client.login(username=user.username, password="123123")
|
|
47
|
+
response = client.get(url)
|
|
48
|
+
assert response.status_code == 200
|
|
49
|
+
assert map.name in response.content.decode()
|
|
50
|
+
|
|
51
|
+
|
|
18
52
|
def test_user_can_see_their_teams(client, team, user):
|
|
19
53
|
user.teams.add(team)
|
|
20
54
|
user.save()
|