django-camomilla-cms 6.0.0b17__py2.py3-none-any.whl → 6.0.1__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 +1 -8
- camomilla/serializers/base/__init__.py +9 -5
- camomilla/settings.py +19 -0
- camomilla/templates/defaults/base.html +60 -4
- camomilla/templatetags/model_extras.py +77 -0
- camomilla/theme/__init__.py +1 -1
- camomilla/theme/admin/pages.py +20 -0
- camomilla/theme/apps.py +1 -0
- camomilla/utils/templates.py +44 -11
- camomilla/views/base/__init__.py +4 -2
- camomilla/views/mixins/pagination.py +1 -1
- django_camomilla_cms-6.0.1.dist-info/METADATA +133 -0
- {django_camomilla_cms-6.0.0b17.dist-info → django_camomilla_cms-6.0.1.dist-info}/RECORD +29 -27
- {django_camomilla_cms-6.0.0b17.dist-info → django_camomilla_cms-6.0.1.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_pages.py +139 -131
- tests/test_templates_context.py +62 -24
- tests/test_utils.py +53 -83
- tests/utils/media.py +5 -4
- django_camomilla_cms-6.0.0b17.dist-info/METADATA +0 -79
- {django_camomilla_cms-6.0.0b17.dist-info → django_camomilla_cms-6.0.1.dist-info}/licenses/LICENSE +0 -0
- {django_camomilla_cms-6.0.0b17.dist-info → django_camomilla_cms-6.0.1.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,124 @@ 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
|
171
|
+
assert response.json()["autopermalink"] == True
|
172
|
+
assert (
|
173
|
+
response.json()["permalink"] == "//permalink_manuale_it_2/titolo_pagina_3"
|
174
|
+
)
|
173
175
|
|
174
176
|
# Check url uniqueness and consistency EN
|
175
177
|
response = self.client.post(
|
176
178
|
"/api/camomilla/pages/",
|
177
179
|
{
|
178
|
-
|
179
|
-
|
180
|
-
}
|
180
|
+
"autopermalink_en": False,
|
181
|
+
"permalink_en": "permalink_manual_en_2",
|
182
|
+
},
|
181
183
|
)
|
182
184
|
|
183
185
|
# Client error when url check uniqueness and consistency fail
|
184
186
|
assert response.status_code == 400
|
185
|
-
assert
|
187
|
+
assert (
|
188
|
+
response.data["permalink_en"][0]
|
189
|
+
== "There is an other page with same permalink."
|
190
|
+
)
|
186
191
|
|
187
192
|
# Check url uniqueness and consistency IT
|
188
193
|
response = self.client.post(
|
189
194
|
"/api/camomilla/pages/",
|
190
195
|
{
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
196
|
+
"translations": {
|
197
|
+
"it": {
|
198
|
+
"autopermalink": False,
|
199
|
+
"permalink": "permalink_manuale_it_2",
|
200
|
+
}
|
195
201
|
}
|
196
|
-
}
|
197
202
|
},
|
198
|
-
format=
|
203
|
+
format="json",
|
199
204
|
)
|
200
205
|
|
201
206
|
# Client error when url check uniqueness and consistency fail
|
202
207
|
assert response.status_code == 400
|
203
|
-
assert
|
204
|
-
|
208
|
+
assert (
|
209
|
+
response.data["permalink_it"][0]
|
210
|
+
== "There is an other page with same permalink."
|
211
|
+
)
|
212
|
+
|
205
213
|
@pytest.mark.django_db
|
206
214
|
def test_pages_url_nodes_navigation(self):
|
207
|
-
#Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
215
|
+
# Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
208
216
|
self.client.post(
|
209
|
-
"/api/camomilla/pages/",
|
217
|
+
"/api/camomilla/pages/",
|
210
218
|
{
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
}
|
219
|
+
"autopermalink_en": False,
|
220
|
+
"permalink_en": "permalink_4_en",
|
221
|
+
"status_en": "PUB",
|
222
|
+
"autopermalink_it": False,
|
223
|
+
"permalink_it": "permalink_4_it",
|
224
|
+
"status_it": "PUB",
|
225
|
+
},
|
218
226
|
)
|
219
227
|
|
220
228
|
response = self.client.get("/permalink_4_en/")
|
@@ -222,24 +230,24 @@ class PagesTestCase(TestCase):
|
|
222
230
|
response = self.client.get("/it/permalink_4_it/")
|
223
231
|
assert response.status_code == 200
|
224
232
|
|
225
|
-
#Test draft - published - planned and ?preview=true
|
233
|
+
# Test draft - published - planned and ?preview=true
|
226
234
|
self.client.post(
|
227
|
-
"/api/camomilla/pages/",
|
235
|
+
"/api/camomilla/pages/",
|
228
236
|
{
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
237
|
+
"translations": {
|
238
|
+
"it": {
|
239
|
+
"autopermalink": False,
|
240
|
+
"permalink": "permalink_5_it",
|
241
|
+
"status": "PLA",
|
242
|
+
},
|
243
|
+
"en": {
|
244
|
+
"autopermalink": False,
|
245
|
+
"permalink": "permalink_5_en",
|
246
|
+
"status": "DRF",
|
247
|
+
},
|
239
248
|
}
|
240
|
-
}
|
241
249
|
},
|
242
|
-
format=
|
250
|
+
format="json",
|
243
251
|
)
|
244
252
|
|
245
253
|
response = self.client.get("/permalink_5_en/")
|
@@ -252,8 +260,9 @@ class PagesTestCase(TestCase):
|
|
252
260
|
self.client.patch(
|
253
261
|
"/api/camomilla/pages/2/",
|
254
262
|
{
|
255
|
-
|
256
|
-
|
263
|
+
"publication_date": (datetime.now() - timedelta(1)).strftime("%Y-%m-%d")
|
264
|
+
+ " 00:00:00",
|
265
|
+
},
|
257
266
|
)
|
258
267
|
|
259
268
|
response = self.client.get("/it/permalink_5_it/")
|
@@ -261,58 +270,57 @@ class PagesTestCase(TestCase):
|
|
261
270
|
|
262
271
|
@pytest.mark.django_db
|
263
272
|
def test_pages_url_nodes_navigation_redirects(self):
|
264
|
-
#Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
273
|
+
# Test the camomilla.dynamic_pages_url handler for navigating and rendering UrlNodes
|
265
274
|
self.client.post(
|
266
|
-
"/api/camomilla/pages/",
|
275
|
+
"/api/camomilla/pages/",
|
267
276
|
{
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
277
|
+
"translations": {
|
278
|
+
"it": {
|
279
|
+
"autopermalink": False,
|
280
|
+
"permalink": "permalink_6_it",
|
281
|
+
"status": "PUB",
|
282
|
+
},
|
283
|
+
"en": {
|
284
|
+
"autopermalink": False,
|
285
|
+
"permalink": "permalink_6_en",
|
286
|
+
"status": "PUB",
|
287
|
+
},
|
278
288
|
}
|
279
|
-
}
|
280
289
|
},
|
281
|
-
format=
|
290
|
+
format="json",
|
282
291
|
)
|
283
292
|
|
284
|
-
#EN Insert Moved Permanently Redirect
|
293
|
+
# EN Insert Moved Permanently Redirect
|
285
294
|
url_redirect = UrlRedirect.objects.create(
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
295
|
+
language_code="en",
|
296
|
+
from_url="/redirecting_1",
|
297
|
+
to_url="/redirected_1",
|
298
|
+
url_node_id=1,
|
290
299
|
)
|
291
300
|
|
292
301
|
response = self.client.get("/redirecting_1/")
|
293
302
|
assert response.status_code == 301
|
294
|
-
assert response.url ==
|
303
|
+
assert response.url == "/redirected_1/"
|
295
304
|
|
296
|
-
#EN Change to Moved Temporarily Redirect
|
305
|
+
# EN Change to Moved Temporarily Redirect
|
297
306
|
url_redirect.permanent = False
|
298
307
|
url_redirect.save()
|
299
308
|
response = self.client.get("/redirecting_1/")
|
300
309
|
assert response.status_code == 302
|
301
|
-
|
302
310
|
|
303
|
-
#IT Insert Moved Permanently Redirect
|
311
|
+
# IT Insert Moved Permanently Redirect
|
304
312
|
url_redirect = UrlRedirect.objects.create(
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
313
|
+
language_code="it",
|
314
|
+
from_url="/urlreindirizzamento_1",
|
315
|
+
to_url="/urlreindirizzato_1",
|
316
|
+
url_node_id=1,
|
309
317
|
)
|
310
318
|
|
311
319
|
response = self.client.get("/it/urlreindirizzamento_1/")
|
312
320
|
assert response.status_code == 301
|
313
|
-
assert response.url ==
|
321
|
+
assert response.url == "/it/urlreindirizzato_1/"
|
314
322
|
|
315
|
-
#IT Change to Moved Temporarily Redirect
|
323
|
+
# IT Change to Moved Temporarily Redirect
|
316
324
|
url_redirect.permanent = False
|
317
325
|
url_redirect.save()
|
318
326
|
response = self.client.get("/it/urlreindirizzamento_1/")
|
@@ -322,22 +330,22 @@ class PagesTestCase(TestCase):
|
|
322
330
|
self.client.patch(
|
323
331
|
"/api/camomilla/pages/1/",
|
324
332
|
{
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
333
|
+
"translations": {
|
334
|
+
"it": {
|
335
|
+
"permalink": "permalink_6_it_changed",
|
336
|
+
},
|
337
|
+
"en": {
|
338
|
+
"permalink": "permalink_6_en_changed",
|
339
|
+
},
|
331
340
|
}
|
332
|
-
}
|
333
341
|
},
|
334
|
-
format=
|
342
|
+
format="json",
|
335
343
|
)
|
336
344
|
|
337
345
|
response = self.client.get("/permalink_6_en/")
|
338
346
|
assert response.status_code == 301
|
339
|
-
assert response.url ==
|
347
|
+
assert response.url == "/permalink_6_en_changed/"
|
340
348
|
|
341
349
|
response = self.client.get("/it/permalink_6_it/")
|
342
350
|
assert response.status_code == 301
|
343
|
-
assert response.url ==
|
351
|
+
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
|
+
)
|