django-camomilla-cms 6.0.0b18__py2.py3-none-any.whl → 6.1.0__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.
- camomilla/__init__.py +1 -1
- camomilla/models/page.py +22 -10
- camomilla/serializers/base/__init__.py +9 -5
- camomilla/serializers/page.py +4 -3
- camomilla/settings.py +22 -3
- camomilla/templatetags/model_extras.py +8 -4
- camomilla/theme/__init__.py +1 -1
- camomilla/theme/admin/pages.py +20 -0
- camomilla/urls.py +3 -3
- camomilla/utils/templates.py +27 -7
- camomilla/views/base/__init__.py +4 -2
- camomilla/views/menus.py +8 -3
- camomilla/views/mixins/pagination.py +1 -1
- camomilla/views/pages.py +4 -4
- django_camomilla_cms-6.1.0.dist-info/METADATA +133 -0
- {django_camomilla_cms-6.0.0b18.dist-info → django_camomilla_cms-6.1.0.dist-info}/RECORD +32 -29
- {django_camomilla_cms-6.0.0b18.dist-info → django_camomilla_cms-6.1.0.dist-info}/WHEEL +1 -1
- tests/fixtures/__init__.py +3 -6
- tests/test_admin_page_form.py +63 -0
- tests/test_camomilla_filters.py +7 -3
- tests/test_media.py +54 -15
- tests/test_menu.py +33 -18
- tests/test_model_api.py +61 -16
- tests/test_model_api_permissions.py +7 -2
- tests/test_model_api_register.py +118 -156
- tests/test_page_meta.py +88 -0
- tests/test_page_relation_api.py +77 -0
- tests/test_pages.py +137 -131
- tests/test_templates_context.py +62 -24
- tests/test_utils.py +53 -83
- django_camomilla_cms-6.0.0b18.dist-info/METADATA +0 -79
- {django_camomilla_cms-6.0.0b18.dist-info → django_camomilla_cms-6.1.0.dist-info}/licenses/LICENSE +0 -0
- {django_camomilla_cms-6.0.0b18.dist-info → django_camomilla_cms-6.1.0.dist-info}/top_level.txt +0 -0
tests/test_pages.py
CHANGED
@@ -11,7 +11,7 @@ class PagesTestCase(TestCase):
|
|
11
11
|
def setUp(self):
|
12
12
|
self.client = APIClient()
|
13
13
|
token = login_superuser()
|
14
|
-
self.client.credentials(HTTP_AUTHORIZATION=
|
14
|
+
self.client.credentials(HTTP_AUTHORIZATION="Token " + token)
|
15
15
|
|
16
16
|
@pytest.mark.django_db
|
17
17
|
def test_pages_api_no_access(self):
|
@@ -25,13 +25,13 @@ class PagesTestCase(TestCase):
|
|
25
25
|
response = self.client.post(
|
26
26
|
"/api/camomilla/pages/",
|
27
27
|
{
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
"translations": {
|
29
|
+
"it": {
|
30
|
+
"title": "title_page_1",
|
31
|
+
}
|
31
32
|
}
|
32
|
-
}
|
33
33
|
},
|
34
|
-
format=
|
34
|
+
format="json",
|
35
35
|
)
|
36
36
|
|
37
37
|
assert response.status_code == 201
|
@@ -44,8 +44,8 @@ class PagesTestCase(TestCase):
|
|
44
44
|
response = self.client.post(
|
45
45
|
"/api/camomilla/pages/",
|
46
46
|
{
|
47
|
-
|
48
|
-
}
|
47
|
+
"title_it": "title_page_2",
|
48
|
+
},
|
49
49
|
)
|
50
50
|
|
51
51
|
assert response.status_code == 201
|
@@ -55,17 +55,17 @@ class PagesTestCase(TestCase):
|
|
55
55
|
assert page.title_it == "title_page_2"
|
56
56
|
assert page.url_node.id == 2
|
57
57
|
|
58
|
-
|
58
|
+
# Update page
|
59
59
|
response = self.client.patch(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
"/api/camomilla/pages/2/",
|
61
|
+
{
|
62
|
+
"translations": {
|
63
|
+
"it": {
|
64
|
+
"title": "title_page_2_updated",
|
65
|
+
}
|
66
|
+
}
|
67
|
+
},
|
68
|
+
format="json",
|
69
69
|
)
|
70
70
|
|
71
71
|
assert response.status_code == 200
|
@@ -78,17 +78,17 @@ class PagesTestCase(TestCase):
|
|
78
78
|
response = self.client.get("/api/camomilla/pages/2/")
|
79
79
|
|
80
80
|
assert response.status_code == 200
|
81
|
-
assert response.json()[
|
82
|
-
assert response.json()[
|
81
|
+
assert response.json()["id"] == 2
|
82
|
+
assert response.json()["title"] == "title_page_2_updated"
|
83
83
|
|
84
84
|
# Read pages
|
85
85
|
response = self.client.get("/api/camomilla/pages/")
|
86
86
|
|
87
87
|
assert response.status_code == 200
|
88
|
-
assert response.json()[0][
|
89
|
-
assert response.json()[0][
|
90
|
-
assert response.json()[1][
|
91
|
-
assert response.json()[1][
|
88
|
+
assert response.json()[0]["id"] == 1
|
89
|
+
assert response.json()[0]["title"] == "title_page_1"
|
90
|
+
assert response.json()[1]["id"] == 2
|
91
|
+
assert response.json()[1]["title"] == "title_page_2_updated"
|
92
92
|
|
93
93
|
# Delete page
|
94
94
|
response = self.client.delete("/api/camomilla/pages/2/")
|
@@ -105,116 +105,122 @@ class PagesTestCase(TestCase):
|
|
105
105
|
response = self.client.post(
|
106
106
|
"/api/camomilla/pages/",
|
107
107
|
{
|
108
|
-
|
109
|
-
|
110
|
-
}
|
108
|
+
"title_en": "title_page_1",
|
109
|
+
"title_it": "titolo_pagina_1",
|
110
|
+
},
|
111
111
|
)
|
112
112
|
|
113
113
|
assert response.status_code == 201
|
114
114
|
|
115
115
|
# EN automatic url creation
|
116
116
|
response = self.client.get("/api/camomilla/pages/1/?language=en")
|
117
|
-
assert response.json()[
|
118
|
-
assert response.json()[
|
117
|
+
assert response.json()["autopermalink"] == True
|
118
|
+
assert response.json()["permalink"] == "/title_page_1"
|
119
119
|
# IT automatic url creation
|
120
120
|
response = self.client.get("/api/camomilla/pages/1/?language=it")
|
121
|
-
assert response.json()[
|
122
|
-
assert response.json()[
|
121
|
+
assert response.json()["autopermalink"] == True
|
122
|
+
assert response.json()["permalink"] == "/titolo_pagina_1"
|
123
123
|
|
124
124
|
# Create page with manual url creation
|
125
125
|
response = self.client.post(
|
126
126
|
"/api/camomilla/pages/",
|
127
127
|
{
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
128
|
+
"translations": {
|
129
|
+
"it": {
|
130
|
+
"title": "titolo_pagina_2",
|
131
|
+
"permalink": "permalink_manuale_it_2",
|
132
|
+
"autopermalink": False,
|
133
|
+
},
|
134
|
+
"en": {
|
135
|
+
"title": "title_page_2",
|
136
|
+
"permalink": "permalink_manual_en_2",
|
137
|
+
"autopermalink": False,
|
138
|
+
},
|
138
139
|
}
|
139
|
-
}
|
140
140
|
},
|
141
|
-
format=
|
141
|
+
format="json",
|
142
142
|
)
|
143
143
|
assert response.status_code == 201
|
144
144
|
|
145
145
|
# EN manual url creation
|
146
146
|
response = self.client.get("/api/camomilla/pages/2/?language=en")
|
147
|
-
assert response.json()[
|
148
|
-
assert response.json()[
|
147
|
+
assert response.json()["autopermalink"] == False
|
148
|
+
assert response.json()["permalink"] == "/permalink_manual_en_2"
|
149
149
|
# IT manual url creation
|
150
150
|
response = self.client.get("/api/camomilla/pages/2/?language=it")
|
151
|
-
assert response.json()[
|
152
|
-
assert response.json()[
|
151
|
+
assert response.json()["autopermalink"] == False
|
152
|
+
assert response.json()["permalink"] == "/permalink_manuale_it_2"
|
153
153
|
|
154
154
|
# Create page with a parent page with automatic url creation
|
155
155
|
response = self.client.post(
|
156
156
|
"/api/camomilla/pages/",
|
157
157
|
{
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
}
|
158
|
+
"title_en": "title_page_3",
|
159
|
+
"title_it": "titolo_pagina_3",
|
160
|
+
"parent_page": 2,
|
161
|
+
},
|
162
162
|
)
|
163
163
|
assert response.status_code == 201
|
164
164
|
|
165
165
|
# EN parent page with automatic url creation
|
166
166
|
response = self.client.get("/api/camomilla/pages/3/?language=en")
|
167
|
-
assert response.json()[
|
168
|
-
assert response.json()[
|
167
|
+
assert response.json()["autopermalink"] == True
|
168
|
+
assert response.json()["permalink"] == "/permalink_manual_en_2/title_page_3"
|
169
169
|
# IT parent page with automatic url creation
|
170
170
|
response = self.client.get("/api/camomilla/pages/3/?language=it")
|
171
|
-
assert response.json()[
|
172
|
-
assert response.json()[
|
171
|
+
assert response.json()["autopermalink"] == True
|
172
|
+
assert response.json()["permalink"] == "/permalink_manuale_it_2/titolo_pagina_3"
|
173
173
|
|
174
174
|
# Check url uniqueness and consistency EN
|
175
175
|
response = self.client.post(
|
176
176
|
"/api/camomilla/pages/",
|
177
177
|
{
|
178
|
-
|
179
|
-
|
180
|
-
}
|
178
|
+
"autopermalink_en": False,
|
179
|
+
"permalink_en": "permalink_manual_en_2",
|
180
|
+
},
|
181
181
|
)
|
182
182
|
|
183
183
|
# Client error when url check uniqueness and consistency fail
|
184
184
|
assert response.status_code == 400
|
185
|
-
assert
|
185
|
+
assert (
|
186
|
+
response.data["permalink_en"][0]
|
187
|
+
== "There is an other page with same permalink."
|
188
|
+
)
|
186
189
|
|
187
190
|
# Check url uniqueness and consistency IT
|
188
191
|
response = self.client.post(
|
189
192
|
"/api/camomilla/pages/",
|
190
193
|
{
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
194
|
+
"translations": {
|
195
|
+
"it": {
|
196
|
+
"autopermalink": False,
|
197
|
+
"permalink": "permalink_manuale_it_2",
|
198
|
+
}
|
195
199
|
}
|
196
|
-
}
|
197
200
|
},
|
198
|
-
format=
|
201
|
+
format="json",
|
199
202
|
)
|
200
203
|
|
201
204
|
# Client error when url check uniqueness and consistency fail
|
202
205
|
assert response.status_code == 400
|
203
|
-
assert
|
204
|
-
|
206
|
+
assert (
|
207
|
+
response.data["permalink_it"][0]
|
208
|
+
== "There is an other page with same permalink."
|
209
|
+
)
|
210
|
+
|
205
211
|
@pytest.mark.django_db
|
206
212
|
def test_pages_url_nodes_navigation(self):
|
207
|
-
#Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
213
|
+
# Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
208
214
|
self.client.post(
|
209
|
-
"/api/camomilla/pages/",
|
215
|
+
"/api/camomilla/pages/",
|
210
216
|
{
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
}
|
217
|
+
"autopermalink_en": False,
|
218
|
+
"permalink_en": "permalink_4_en",
|
219
|
+
"status_en": "PUB",
|
220
|
+
"autopermalink_it": False,
|
221
|
+
"permalink_it": "permalink_4_it",
|
222
|
+
"status_it": "PUB",
|
223
|
+
},
|
218
224
|
)
|
219
225
|
|
220
226
|
response = self.client.get("/permalink_4_en/")
|
@@ -222,24 +228,24 @@ class PagesTestCase(TestCase):
|
|
222
228
|
response = self.client.get("/it/permalink_4_it/")
|
223
229
|
assert response.status_code == 200
|
224
230
|
|
225
|
-
#Test draft - published - planned and ?preview=true
|
231
|
+
# Test draft - published - planned and ?preview=true
|
226
232
|
self.client.post(
|
227
|
-
"/api/camomilla/pages/",
|
233
|
+
"/api/camomilla/pages/",
|
228
234
|
{
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
235
|
+
"translations": {
|
236
|
+
"it": {
|
237
|
+
"autopermalink": False,
|
238
|
+
"permalink": "permalink_5_it",
|
239
|
+
"status": "PLA",
|
240
|
+
},
|
241
|
+
"en": {
|
242
|
+
"autopermalink": False,
|
243
|
+
"permalink": "permalink_5_en",
|
244
|
+
"status": "DRF",
|
245
|
+
},
|
239
246
|
}
|
240
|
-
}
|
241
247
|
},
|
242
|
-
format=
|
248
|
+
format="json",
|
243
249
|
)
|
244
250
|
|
245
251
|
response = self.client.get("/permalink_5_en/")
|
@@ -252,8 +258,9 @@ class PagesTestCase(TestCase):
|
|
252
258
|
self.client.patch(
|
253
259
|
"/api/camomilla/pages/2/",
|
254
260
|
{
|
255
|
-
|
256
|
-
|
261
|
+
"publication_date": (datetime.now() - timedelta(1)).strftime("%Y-%m-%d")
|
262
|
+
+ " 00:00:00",
|
263
|
+
},
|
257
264
|
)
|
258
265
|
|
259
266
|
response = self.client.get("/it/permalink_5_it/")
|
@@ -261,58 +268,57 @@ class PagesTestCase(TestCase):
|
|
261
268
|
|
262
269
|
@pytest.mark.django_db
|
263
270
|
def test_pages_url_nodes_navigation_redirects(self):
|
264
|
-
#Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
271
|
+
# Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
265
272
|
self.client.post(
|
266
|
-
"/api/camomilla/pages/",
|
273
|
+
"/api/camomilla/pages/",
|
267
274
|
{
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
275
|
+
"translations": {
|
276
|
+
"it": {
|
277
|
+
"autopermalink": False,
|
278
|
+
"permalink": "permalink_6_it",
|
279
|
+
"status": "PUB",
|
280
|
+
},
|
281
|
+
"en": {
|
282
|
+
"autopermalink": False,
|
283
|
+
"permalink": "permalink_6_en",
|
284
|
+
"status": "PUB",
|
285
|
+
},
|
278
286
|
}
|
279
|
-
}
|
280
287
|
},
|
281
|
-
format=
|
288
|
+
format="json",
|
282
289
|
)
|
283
290
|
|
284
|
-
#EN Insert Moved Permanently Redirect
|
291
|
+
# EN Insert Moved Permanently Redirect
|
285
292
|
url_redirect = UrlRedirect.objects.create(
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
293
|
+
language_code="en",
|
294
|
+
from_url="/redirecting_1",
|
295
|
+
to_url="/redirected_1",
|
296
|
+
url_node_id=1,
|
290
297
|
)
|
291
298
|
|
292
299
|
response = self.client.get("/redirecting_1/")
|
293
300
|
assert response.status_code == 301
|
294
|
-
assert response.url ==
|
301
|
+
assert response.url == "/redirected_1/"
|
295
302
|
|
296
|
-
#EN Change to Moved Temporarily Redirect
|
303
|
+
# EN Change to Moved Temporarily Redirect
|
297
304
|
url_redirect.permanent = False
|
298
305
|
url_redirect.save()
|
299
306
|
response = self.client.get("/redirecting_1/")
|
300
307
|
assert response.status_code == 302
|
301
|
-
|
302
308
|
|
303
|
-
#IT Insert Moved Permanently Redirect
|
309
|
+
# IT Insert Moved Permanently Redirect
|
304
310
|
url_redirect = UrlRedirect.objects.create(
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
311
|
+
language_code="it",
|
312
|
+
from_url="/urlreindirizzamento_1",
|
313
|
+
to_url="/urlreindirizzato_1",
|
314
|
+
url_node_id=1,
|
309
315
|
)
|
310
316
|
|
311
317
|
response = self.client.get("/it/urlreindirizzamento_1/")
|
312
318
|
assert response.status_code == 301
|
313
|
-
assert response.url ==
|
319
|
+
assert response.url == "/it/urlreindirizzato_1/"
|
314
320
|
|
315
|
-
#IT Change to Moved Temporarily Redirect
|
321
|
+
# IT Change to Moved Temporarily Redirect
|
316
322
|
url_redirect.permanent = False
|
317
323
|
url_redirect.save()
|
318
324
|
response = self.client.get("/it/urlreindirizzamento_1/")
|
@@ -322,22 +328,22 @@ class PagesTestCase(TestCase):
|
|
322
328
|
self.client.patch(
|
323
329
|
"/api/camomilla/pages/1/",
|
324
330
|
{
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
+
"translations": {
|
332
|
+
"it": {
|
333
|
+
"permalink": "permalink_6_it_changed",
|
334
|
+
},
|
335
|
+
"en": {
|
336
|
+
"permalink": "permalink_6_en_changed",
|
337
|
+
},
|
331
338
|
}
|
332
|
-
}
|
333
339
|
},
|
334
|
-
format=
|
340
|
+
format="json",
|
335
341
|
)
|
336
342
|
|
337
343
|
response = self.client.get("/permalink_6_en/")
|
338
344
|
assert response.status_code == 301
|
339
|
-
assert response.url ==
|
345
|
+
assert response.url == "/permalink_6_en_changed/"
|
340
346
|
|
341
347
|
response = self.client.get("/it/permalink_6_it/")
|
342
348
|
assert response.status_code == 301
|
343
|
-
assert response.url ==
|
349
|
+
assert response.url == "/it/permalink_6_it_changed/"
|
tests/test_templates_context.py
CHANGED
@@ -6,11 +6,12 @@ from rest_framework.test import APIClient
|
|
6
6
|
from .utils.api import login_superuser
|
7
7
|
from .utils.media import load_asset_and_remove_media
|
8
8
|
|
9
|
+
|
9
10
|
class TemoplateContextTestCase(TestCase):
|
10
11
|
def setUp(self):
|
11
12
|
self.client = APIClient()
|
12
13
|
token = login_superuser()
|
13
|
-
self.client.credentials(HTTP_AUTHORIZATION=
|
14
|
+
self.client.credentials(HTTP_AUTHORIZATION="Token " + token)
|
14
15
|
|
15
16
|
@pytest.mark.django_db
|
16
17
|
def test_page_context_template_based(self):
|
@@ -18,11 +19,11 @@ class TemoplateContextTestCase(TestCase):
|
|
18
19
|
response = self.client.post(
|
19
20
|
"/api/camomilla/pages/",
|
20
21
|
{
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
"title_en": "Page custom context template",
|
23
|
+
"autopermalink_en": False,
|
24
|
+
"permalink_en": "permalink_context_template",
|
25
|
+
"template": "website/page_context_template_based.html",
|
26
|
+
"status_en": "PUB",
|
26
27
|
},
|
27
28
|
format="multipart",
|
28
29
|
)
|
@@ -34,7 +35,17 @@ class TemoplateContextTestCase(TestCase):
|
|
34
35
|
"/api/camomilla/media/",
|
35
36
|
{
|
36
37
|
"file": asset,
|
37
|
-
"data": json.dumps(
|
38
|
+
"data": json.dumps(
|
39
|
+
{
|
40
|
+
"translations": {
|
41
|
+
"en": {
|
42
|
+
"alt_text": "Test media",
|
43
|
+
"title": "Test media",
|
44
|
+
"description": "Description media",
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
),
|
38
49
|
},
|
39
50
|
format="multipart",
|
40
51
|
)
|
@@ -42,8 +53,10 @@ class TemoplateContextTestCase(TestCase):
|
|
42
53
|
|
43
54
|
response = self.client.get("/permalink_context_template/")
|
44
55
|
assert response.status_code == 200
|
45
|
-
assert
|
46
|
-
|
56
|
+
assert (
|
57
|
+
re.sub(r"[\s+]", "", response.content.decode())
|
58
|
+
== "<!DOCTYPEhtml><html><body><h1>Titlepageforpagecontexttemplatebased</h1><p>Contentpageforpagecontexttemplatebased</p><ul><li>Testmedia</li></ul></body></html>"
|
59
|
+
)
|
47
60
|
|
48
61
|
@pytest.mark.django_db
|
49
62
|
def test_model_context_template_based(self):
|
@@ -51,11 +64,11 @@ class TemoplateContextTestCase(TestCase):
|
|
51
64
|
response = self.client.post(
|
52
65
|
"/api/camomilla/pages/",
|
53
66
|
{
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
67
|
+
"title_en": "Page custom context template",
|
68
|
+
"autopermalink_en": False,
|
69
|
+
"permalink_en": "permalink_context_template",
|
70
|
+
"template": "website/page_context_model_based.html",
|
71
|
+
"status_en": "PUB",
|
59
72
|
},
|
60
73
|
format="multipart",
|
61
74
|
)
|
@@ -67,7 +80,17 @@ class TemoplateContextTestCase(TestCase):
|
|
67
80
|
"/api/camomilla/media/",
|
68
81
|
{
|
69
82
|
"file": asset,
|
70
|
-
"data": json.dumps(
|
83
|
+
"data": json.dumps(
|
84
|
+
{
|
85
|
+
"translations": {
|
86
|
+
"en": {
|
87
|
+
"alt_text": "Test media",
|
88
|
+
"title": "Test media",
|
89
|
+
"description": "Description media",
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
),
|
71
94
|
},
|
72
95
|
format="multipart",
|
73
96
|
)
|
@@ -75,8 +98,10 @@ class TemoplateContextTestCase(TestCase):
|
|
75
98
|
|
76
99
|
response = self.client.get("/permalink_context_template/")
|
77
100
|
assert response.status_code == 200
|
78
|
-
assert
|
79
|
-
|
101
|
+
assert (
|
102
|
+
re.sub(r"[\s+]", "", response.content.decode())
|
103
|
+
== "<!DOCTYPEhtml><html><body><h1>Titlepageforpagecontextmodelbased</h1><p>Contentpageforpagecontextmodelbased</p><ul><li>Testmedia</li></ul></body></html>"
|
104
|
+
)
|
80
105
|
|
81
106
|
@pytest.mark.django_db
|
82
107
|
def test_mixed_context_template(self):
|
@@ -84,11 +109,11 @@ class TemoplateContextTestCase(TestCase):
|
|
84
109
|
response = self.client.post(
|
85
110
|
"/api/camomilla/pages/",
|
86
111
|
{
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
112
|
+
"title_en": "Page custom context template",
|
113
|
+
"autopermalink_en": False,
|
114
|
+
"permalink_en": "permalink_context_template",
|
115
|
+
"template": "website/page_context_mixed.html",
|
116
|
+
"status_en": "PUB",
|
92
117
|
},
|
93
118
|
format="multipart",
|
94
119
|
)
|
@@ -100,7 +125,17 @@ class TemoplateContextTestCase(TestCase):
|
|
100
125
|
"/api/camomilla/media/",
|
101
126
|
{
|
102
127
|
"file": asset,
|
103
|
-
"data": json.dumps(
|
128
|
+
"data": json.dumps(
|
129
|
+
{
|
130
|
+
"translations": {
|
131
|
+
"en": {
|
132
|
+
"alt_text": "Test media",
|
133
|
+
"title": "Test media",
|
134
|
+
"description": "Description media",
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
),
|
104
139
|
},
|
105
140
|
format="multipart",
|
106
141
|
)
|
@@ -108,4 +143,7 @@ class TemoplateContextTestCase(TestCase):
|
|
108
143
|
|
109
144
|
response = self.client.get("/permalink_context_template/")
|
110
145
|
assert response.status_code == 200
|
111
|
-
assert
|
146
|
+
assert (
|
147
|
+
re.sub(r"[\s+]", "", response.content.decode())
|
148
|
+
== "<!DOCTYPEhtml><html><body><!--Templatecontext--><h1>Titlepageforpagecontexttemplatebased</h1><p>Contentpageforpagecontexttemplatebased</p><ul><li>Testmedia</li></ul><!--Modelcontext--><h1>Titlepageforpagecontextmodelbased</h1><p>Contentpageforpagecontextmodelbased</p><ul><li>Testmedia</li></ul></body></html>"
|
149
|
+
)
|