|
|
@@ -14,6 +14,7 @@ from tracim_backend.exceptions import SameValueError
|
|
14
|
14
|
from tracim_backend.lib.core.workspace import RoleApi
|
|
15
|
15
|
# TODO - G.M - 28-03-2018 - [WorkspaceApi] Re-enable WorkspaceApi
|
|
16
|
16
|
from tracim_backend.lib.core.workspace import WorkspaceApi
|
|
|
17
|
+from tracim_backend.models.contents import CONTENT_TYPES
|
|
17
|
18
|
from tracim_backend.models.revision_protection import new_revision
|
|
18
|
19
|
from tracim_backend.models.auth import User
|
|
19
|
20
|
from tracim_backend.models.auth import Group
|
|
|
@@ -22,7 +23,6 @@ from tracim_backend.models.data import ActionDescription
|
|
22
|
23
|
from tracim_backend.models.data import ContentRevisionRO
|
|
23
|
24
|
from tracim_backend.models.data import Workspace
|
|
24
|
25
|
from tracim_backend.models.data import Content
|
|
25
|
|
-from tracim_backend.models.data import ContentType
|
|
26
|
26
|
from tracim_backend.models.data import UserRoleInWorkspace
|
|
27
|
27
|
from tracim_backend.fixtures.users_and_groups import Test as FixtureTest
|
|
28
|
28
|
from tracim_backend.tests import DefaultTest
|
|
|
@@ -129,14 +129,14 @@ class TestContentApi(DefaultTest):
|
|
129
|
129
|
config=self.app_config,
|
|
130
|
130
|
)
|
|
131
|
131
|
item = api.create(
|
|
132
|
|
- content_type=ContentType.Folder,
|
|
|
132
|
+ content_type_slug=CONTENT_TYPES.Folder.slug,
|
|
133
|
133
|
workspace=workspace,
|
|
134
|
134
|
parent=None,
|
|
135
|
135
|
label='not_deleted',
|
|
136
|
136
|
do_save=True
|
|
137
|
137
|
)
|
|
138
|
138
|
item2 = api.create(
|
|
139
|
|
- content_type=ContentType.Folder,
|
|
|
139
|
+ content_type_slug=CONTENT_TYPES.Folder.slug,
|
|
140
|
140
|
workspace=workspace,
|
|
141
|
141
|
parent=None,
|
|
142
|
142
|
label='to_delete',
|
|
|
@@ -159,10 +159,10 @@ class TestContentApi(DefaultTest):
|
|
159
|
159
|
session=self.session,
|
|
160
|
160
|
config=self.app_config,
|
|
161
|
161
|
)
|
|
162
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
162
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
163
|
163
|
eq_(2, len(items))
|
|
164
|
164
|
|
|
165
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
165
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
166
|
166
|
with new_revision(
|
|
167
|
167
|
session=self.session,
|
|
168
|
168
|
tm=transaction.manager,
|
|
|
@@ -184,7 +184,7 @@ class TestContentApi(DefaultTest):
|
|
184
|
184
|
session=self.session,
|
|
185
|
185
|
config=self.app_config,
|
|
186
|
186
|
)
|
|
187
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
187
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
188
|
188
|
eq_(1, len(items))
|
|
189
|
189
|
transaction.commit()
|
|
190
|
190
|
|
|
|
@@ -202,7 +202,7 @@ class TestContentApi(DefaultTest):
|
|
202
|
202
|
config=self.app_config,
|
|
203
|
203
|
show_deleted=True,
|
|
204
|
204
|
)
|
|
205
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
205
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
206
|
206
|
eq_(2, len(items))
|
|
207
|
207
|
|
|
208
|
208
|
def test_archive(self):
|
|
|
@@ -240,14 +240,14 @@ class TestContentApi(DefaultTest):
|
|
240
|
240
|
config=self.app_config,
|
|
241
|
241
|
)
|
|
242
|
242
|
item = api.create(
|
|
243
|
|
- content_type=ContentType.Folder,
|
|
|
243
|
+ content_type_slug=CONTENT_TYPES.Folder.slug,
|
|
244
|
244
|
workspace=workspace,
|
|
245
|
245
|
parent=None,
|
|
246
|
246
|
label='not_archived',
|
|
247
|
247
|
do_save=True
|
|
248
|
248
|
)
|
|
249
|
249
|
item2 = api.create(
|
|
250
|
|
- content_type=ContentType.Folder,
|
|
|
250
|
+ content_type_slug=CONTENT_TYPES.Folder.slug,
|
|
251
|
251
|
workspace=workspace,
|
|
252
|
252
|
parent=None,
|
|
253
|
253
|
label='to_archive',
|
|
|
@@ -269,10 +269,10 @@ class TestContentApi(DefaultTest):
|
|
269
|
269
|
config=self.app_config,
|
|
270
|
270
|
)
|
|
271
|
271
|
|
|
272
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
272
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
273
|
273
|
eq_(2, len(items))
|
|
274
|
274
|
|
|
275
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
275
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
276
|
276
|
with new_revision(
|
|
277
|
277
|
session=self.session,
|
|
278
|
278
|
tm=transaction.manager,
|
|
|
@@ -295,7 +295,7 @@ class TestContentApi(DefaultTest):
|
|
295
|
295
|
config=self.app_config,
|
|
296
|
296
|
)
|
|
297
|
297
|
|
|
298
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
298
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
299
|
299
|
eq_(1, len(items))
|
|
300
|
300
|
transaction.commit()
|
|
301
|
301
|
|
|
|
@@ -320,7 +320,7 @@ class TestContentApi(DefaultTest):
|
|
320
|
320
|
config=self.app_config,
|
|
321
|
321
|
show_archived=True,
|
|
322
|
322
|
)
|
|
323
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
323
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
324
|
324
|
eq_(2, len(items))
|
|
325
|
325
|
|
|
326
|
326
|
def test_get_all_with_filter(self):
|
|
|
@@ -358,14 +358,14 @@ class TestContentApi(DefaultTest):
|
|
358
|
358
|
config=self.app_config,
|
|
359
|
359
|
)
|
|
360
|
360
|
item = api.create(
|
|
361
|
|
- content_type=ContentType.Folder,
|
|
|
361
|
+ content_type_slug=CONTENT_TYPES.Folder.slug,
|
|
362
|
362
|
workspace=workspace,
|
|
363
|
363
|
parent=None,
|
|
364
|
364
|
label='thefolder',
|
|
365
|
365
|
do_save=True
|
|
366
|
366
|
)
|
|
367
|
367
|
item2 = api.create(
|
|
368
|
|
- content_type=ContentType.File,
|
|
|
368
|
+ content_type_slug=CONTENT_TYPES.File.slug,
|
|
369
|
369
|
workspace=workspace,
|
|
370
|
370
|
parent=None,
|
|
371
|
371
|
label='thefile',
|
|
|
@@ -389,14 +389,14 @@ class TestContentApi(DefaultTest):
|
|
389
|
389
|
config=self.app_config,
|
|
390
|
390
|
)
|
|
391
|
391
|
|
|
392
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
392
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
393
|
393
|
eq_(2, len(items))
|
|
394
|
394
|
|
|
395
|
|
- items2 = api.get_all(None, ContentType.File, workspace)
|
|
|
395
|
+ items2 = api.get_all(None, CONTENT_TYPES.File.slug, workspace)
|
|
396
|
396
|
eq_(1, len(items2))
|
|
397
|
397
|
eq_('thefile', items2[0].label)
|
|
398
|
398
|
|
|
399
|
|
- items3 = api.get_all(None, ContentType.Folder, workspace)
|
|
|
399
|
+ items3 = api.get_all(None, CONTENT_TYPES.Folder.slug, workspace)
|
|
400
|
400
|
eq_(1, len(items3))
|
|
401
|
401
|
eq_('thefolder', items3[0].label)
|
|
402
|
402
|
|
|
|
@@ -428,21 +428,21 @@ class TestContentApi(DefaultTest):
|
|
428
|
428
|
config=self.app_config,
|
|
429
|
429
|
)
|
|
430
|
430
|
item = api.create(
|
|
431
|
|
- ContentType.Folder,
|
|
|
431
|
+ CONTENT_TYPES.Folder.slug,
|
|
432
|
432
|
workspace,
|
|
433
|
433
|
None,
|
|
434
|
434
|
'parent',
|
|
435
|
435
|
do_save=True,
|
|
436
|
436
|
)
|
|
437
|
437
|
item2 = api.create(
|
|
438
|
|
- ContentType.File,
|
|
|
438
|
+ CONTENT_TYPES.File.slug,
|
|
439
|
439
|
workspace,
|
|
440
|
440
|
item,
|
|
441
|
441
|
'file1',
|
|
442
|
442
|
do_save=True,
|
|
443
|
443
|
)
|
|
444
|
444
|
item3 = api.create(
|
|
445
|
|
- ContentType.File,
|
|
|
445
|
+ CONTENT_TYPES.File.slug,
|
|
446
|
446
|
workspace,
|
|
447
|
447
|
None,
|
|
448
|
448
|
'file2',
|
|
|
@@ -468,10 +468,10 @@ class TestContentApi(DefaultTest):
|
|
468
|
468
|
config=self.app_config,
|
|
469
|
469
|
)
|
|
470
|
470
|
|
|
471
|
|
- items = api.get_all(None, ContentType.Any, workspace)
|
|
|
471
|
+ items = api.get_all(None, CONTENT_TYPES.Any_SLUG, workspace)
|
|
472
|
472
|
eq_(3, len(items))
|
|
473
|
473
|
|
|
474
|
|
- items2 = api.get_all(parent_id, ContentType.File, workspace)
|
|
|
474
|
+ items2 = api.get_all(parent_id, CONTENT_TYPES.File.slug, workspace)
|
|
475
|
475
|
eq_(1, len(items2))
|
|
476
|
476
|
eq_(child_id, items2[0].content_id)
|
|
477
|
477
|
|
|
|
@@ -506,7 +506,7 @@ class TestContentApi(DefaultTest):
|
|
506
|
506
|
session=self.session,
|
|
507
|
507
|
config=self.app_config,
|
|
508
|
508
|
)
|
|
509
|
|
- c = api.create(ContentType.Folder, workspace, None, 'parent', '', True)
|
|
|
509
|
+ c = api.create(CONTENT_TYPES.Folder.slug, workspace, None, 'parent', '', True)
|
|
510
|
510
|
with new_revision(
|
|
511
|
511
|
session=self.session,
|
|
512
|
512
|
tm=transaction.manager,
|
|
|
@@ -546,7 +546,7 @@ class TestContentApi(DefaultTest):
|
|
546
|
546
|
session=self.session,
|
|
547
|
547
|
config=self.app_config,
|
|
548
|
548
|
)
|
|
549
|
|
- c = api.create(ContentType.Folder, workspace, None, 'parent', '', True)
|
|
|
549
|
+ c = api.create(CONTENT_TYPES.Folder.slug, workspace, None, 'parent', '', True)
|
|
550
|
550
|
with new_revision(
|
|
551
|
551
|
session=self.session,
|
|
552
|
552
|
tm=transaction.manager,
|
|
|
@@ -591,14 +591,14 @@ class TestContentApi(DefaultTest):
|
|
591
|
591
|
session=self.session,
|
|
592
|
592
|
config=self.app_config,
|
|
593
|
593
|
)
|
|
594
|
|
- p = api.create(ContentType.Page, workspace, None, 'this_is_a_page')
|
|
|
594
|
+ p = api.create(CONTENT_TYPES.Page.slug, workspace, None, 'this_is_a_page')
|
|
595
|
595
|
c = api.create_comment(workspace, p, 'this is the comment', True)
|
|
596
|
596
|
|
|
597
|
597
|
eq_(Content, c.__class__)
|
|
598
|
598
|
eq_(p.content_id, c.parent_id)
|
|
599
|
599
|
eq_(user, c.owner)
|
|
600
|
600
|
eq_(workspace, c.workspace)
|
|
601
|
|
- eq_(ContentType.Comment, c.type)
|
|
|
601
|
+ eq_(CONTENT_TYPES.Comment.slug, c.type)
|
|
602
|
602
|
eq_('this is the comment', c.description)
|
|
603
|
603
|
eq_('', c.label)
|
|
604
|
604
|
eq_(ActionDescription.COMMENT, c.revision_type)
|
|
|
@@ -652,7 +652,7 @@ class TestContentApi(DefaultTest):
|
|
652
|
652
|
config=self.app_config,
|
|
653
|
653
|
)
|
|
654
|
654
|
foldera = api.create(
|
|
655
|
|
- ContentType.Folder,
|
|
|
655
|
+ CONTENT_TYPES.Folder.slug,
|
|
656
|
656
|
workspace,
|
|
657
|
657
|
None,
|
|
658
|
658
|
'folder a',
|
|
|
@@ -661,7 +661,7 @@ class TestContentApi(DefaultTest):
|
|
661
|
661
|
)
|
|
662
|
662
|
with self.session.no_autoflush:
|
|
663
|
663
|
text_file = api.create(
|
|
664
|
|
- content_type=ContentType.File,
|
|
|
664
|
+ content_type_slug=CONTENT_TYPES.File.slug,
|
|
665
|
665
|
workspace=workspace,
|
|
666
|
666
|
parent=foldera,
|
|
667
|
667
|
label='test_file',
|
|
|
@@ -689,7 +689,7 @@ class TestContentApi(DefaultTest):
|
|
689
|
689
|
save_now=True
|
|
690
|
690
|
)
|
|
691
|
691
|
folderb = api2.create(
|
|
692
|
|
- ContentType.Folder,
|
|
|
692
|
+ CONTENT_TYPES.Folder.slug,
|
|
693
|
693
|
workspace2,
|
|
694
|
694
|
None,
|
|
695
|
695
|
'folder b',
|
|
|
@@ -773,7 +773,7 @@ class TestContentApi(DefaultTest):
|
|
773
|
773
|
config=self.app_config,
|
|
774
|
774
|
)
|
|
775
|
775
|
foldera = api.create(
|
|
776
|
|
- ContentType.Folder,
|
|
|
776
|
+ CONTENT_TYPES.Folder.slug,
|
|
777
|
777
|
workspace,
|
|
778
|
778
|
None,
|
|
779
|
779
|
'folder a',
|
|
|
@@ -782,7 +782,7 @@ class TestContentApi(DefaultTest):
|
|
782
|
782
|
)
|
|
783
|
783
|
with self.session.no_autoflush:
|
|
784
|
784
|
text_file = api.create(
|
|
785
|
|
- content_type=ContentType.File,
|
|
|
785
|
+ content_type_slug=CONTENT_TYPES.File.slug,
|
|
786
|
786
|
workspace=workspace,
|
|
787
|
787
|
parent=foldera,
|
|
788
|
788
|
label='test_file',
|
|
|
@@ -810,7 +810,7 @@ class TestContentApi(DefaultTest):
|
|
810
|
810
|
save_now=True
|
|
811
|
811
|
)
|
|
812
|
812
|
folderb = api2.create(
|
|
813
|
|
- ContentType.Folder,
|
|
|
813
|
+ CONTENT_TYPES.Folder.slug,
|
|
814
|
814
|
workspace2,
|
|
815
|
815
|
None,
|
|
816
|
816
|
'folder b',
|
|
|
@@ -891,7 +891,7 @@ class TestContentApi(DefaultTest):
|
|
891
|
891
|
config=self.app_config,
|
|
892
|
892
|
)
|
|
893
|
893
|
foldera = api.create(
|
|
894
|
|
- ContentType.Folder,
|
|
|
894
|
+ CONTENT_TYPES.Folder.slug,
|
|
895
|
895
|
workspace,
|
|
896
|
896
|
None,
|
|
897
|
897
|
'folder a',
|
|
|
@@ -900,7 +900,7 @@ class TestContentApi(DefaultTest):
|
|
900
|
900
|
)
|
|
901
|
901
|
with self.session.no_autoflush:
|
|
902
|
902
|
text_file = api.create(
|
|
903
|
|
- content_type=ContentType.File,
|
|
|
903
|
+ content_type_slug=CONTENT_TYPES.File.slug,
|
|
904
|
904
|
workspace=workspace,
|
|
905
|
905
|
parent=foldera,
|
|
906
|
906
|
label='test_file',
|
|
|
@@ -1014,13 +1014,13 @@ class TestContentApi(DefaultTest):
|
|
1014
|
1014
|
|
|
1015
|
1015
|
# Creates page_1 & page_2 in workspace 1
|
|
1016
|
1016
|
# and page_3 & page_4 in workspace 2
|
|
1017
|
|
- page_1 = cont_api_a.create(ContentType.Page, workspace1, None,
|
|
|
1017
|
+ page_1 = cont_api_a.create(CONTENT_TYPES.Page.slug, workspace1, None,
|
|
1018
|
1018
|
'this is a page', do_save=True)
|
|
1019
|
|
- page_2 = cont_api_a.create(ContentType.Page, workspace1, None,
|
|
|
1019
|
+ page_2 = cont_api_a.create(CONTENT_TYPES.Page.slug, workspace1, None,
|
|
1020
|
1020
|
'this is page1', do_save=True)
|
|
1021
|
|
- page_3 = cont_api_a.create(ContentType.Thread, workspace2, None,
|
|
|
1021
|
+ page_3 = cont_api_a.create(CONTENT_TYPES.Thread.slug, workspace2, None,
|
|
1022
|
1022
|
'this is page2', do_save=True)
|
|
1023
|
|
- page_4 = cont_api_a.create(ContentType.File, workspace2, None,
|
|
|
1023
|
+ page_4 = cont_api_a.create(CONTENT_TYPES.File.slug, workspace2, None,
|
|
1024
|
1024
|
'this is page3', do_save=True)
|
|
1025
|
1025
|
|
|
1026
|
1026
|
for rev in page_1.revisions:
|
|
|
@@ -1118,7 +1118,7 @@ class TestContentApi(DefaultTest):
|
|
1118
|
1118
|
config=self.app_config,
|
|
1119
|
1119
|
)
|
|
1120
|
1120
|
|
|
1121
|
|
- page_1 = cont_api_a.create(ContentType.Page, workspace, None,
|
|
|
1121
|
+ page_1 = cont_api_a.create(CONTENT_TYPES.Page.slug, workspace, None,
|
|
1122
|
1122
|
'this is a page', do_save=True)
|
|
1123
|
1123
|
|
|
1124
|
1124
|
for rev in page_1.revisions:
|
|
|
@@ -1187,21 +1187,21 @@ class TestContentApi(DefaultTest):
|
|
1187
|
1187
|
)
|
|
1188
|
1188
|
|
|
1189
|
1189
|
page_2 = cont_api_a.create(
|
|
1190
|
|
- ContentType.Page,
|
|
|
1190
|
+ CONTENT_TYPES.Page.slug,
|
|
1191
|
1191
|
workspace,
|
|
1192
|
1192
|
None,
|
|
1193
|
1193
|
'this is page1',
|
|
1194
|
1194
|
do_save=True
|
|
1195
|
1195
|
)
|
|
1196
|
1196
|
page_3 = cont_api_a.create(
|
|
1197
|
|
- ContentType.Thread,
|
|
|
1197
|
+ CONTENT_TYPES.Thread.slug,
|
|
1198
|
1198
|
workspace,
|
|
1199
|
1199
|
None,
|
|
1200
|
1200
|
'this is page2',
|
|
1201
|
1201
|
do_save=True
|
|
1202
|
1202
|
)
|
|
1203
|
1203
|
page_4 = cont_api_a.create(
|
|
1204
|
|
- ContentType.File,
|
|
|
1204
|
+ CONTENT_TYPES.File.slug,
|
|
1205
|
1205
|
workspace,
|
|
1206
|
1206
|
None,
|
|
1207
|
1207
|
'this is page3',
|
|
|
@@ -1285,7 +1285,7 @@ class TestContentApi(DefaultTest):
|
|
1285
|
1285
|
)
|
|
1286
|
1286
|
|
|
1287
|
1287
|
p = api.create(
|
|
1288
|
|
- content_type=ContentType.Page,
|
|
|
1288
|
+ content_type_slug=CONTENT_TYPES.Page.slug,
|
|
1289
|
1289
|
workspace=workspace,
|
|
1290
|
1290
|
parent=None,
|
|
1291
|
1291
|
label='this_is_a_page',
|
|
|
@@ -1312,7 +1312,7 @@ class TestContentApi(DefaultTest):
|
|
1312
|
1312
|
config=self.app_config,
|
|
1313
|
1313
|
)
|
|
1314
|
1314
|
|
|
1315
|
|
- content = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1315
|
+ content = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1316
|
1316
|
eq_(u1id, content.owner_id)
|
|
1317
|
1317
|
eq_(poid, content.owner_id)
|
|
1318
|
1318
|
|
|
|
@@ -1326,7 +1326,7 @@ class TestContentApi(DefaultTest):
|
|
1326
|
1326
|
session=self.session,
|
|
1327
|
1327
|
config=self.app_config,
|
|
1328
|
1328
|
)
|
|
1329
|
|
- content2 = api2.get_one(pcid, ContentType.Any, workspace)
|
|
|
1329
|
+ content2 = api2.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1330
|
1330
|
with new_revision(
|
|
1331
|
1331
|
session=self.session,
|
|
1332
|
1332
|
tm=transaction.manager,
|
|
|
@@ -1353,7 +1353,7 @@ class TestContentApi(DefaultTest):
|
|
1353
|
1353
|
config=self.app_config,
|
|
1354
|
1354
|
)
|
|
1355
|
1355
|
|
|
1356
|
|
- updated = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1356
|
+ updated = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1357
|
1357
|
eq_(u2id, updated.owner_id,
|
|
1358
|
1358
|
'the owner id should be {} (found {})'.format(u2id,
|
|
1359
|
1359
|
updated.owner_id))
|
|
|
@@ -1412,7 +1412,7 @@ class TestContentApi(DefaultTest):
|
|
1412
|
1412
|
)
|
|
1413
|
1413
|
with self.session.no_autoflush:
|
|
1414
|
1414
|
page = api.create(
|
|
1415
|
|
- content_type=ContentType.Page,
|
|
|
1415
|
+ content_type_slug=CONTENT_TYPES.Page.slug,
|
|
1416
|
1416
|
workspace=workspace,
|
|
1417
|
1417
|
label="same_content",
|
|
1418
|
1418
|
do_save=False
|
|
|
@@ -1426,7 +1426,7 @@ class TestContentApi(DefaultTest):
|
|
1426
|
1426
|
session=self.session,
|
|
1427
|
1427
|
config=self.app_config,
|
|
1428
|
1428
|
)
|
|
1429
|
|
- content2 = api2.get_one(page.content_id, ContentType.Any, workspace)
|
|
|
1429
|
+ content2 = api2.get_one(page.content_id, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1430
|
1430
|
with new_revision(
|
|
1431
|
1431
|
session=self.session,
|
|
1432
|
1432
|
tm=transaction.manager,
|
|
|
@@ -1495,7 +1495,7 @@ class TestContentApi(DefaultTest):
|
|
1495
|
1495
|
config=self.app_config,
|
|
1496
|
1496
|
)
|
|
1497
|
1497
|
p = api.create(
|
|
1498
|
|
- content_type=ContentType.File,
|
|
|
1498
|
+ content_type_slug=CONTENT_TYPES.File.slug,
|
|
1499
|
1499
|
workspace=workspace,
|
|
1500
|
1500
|
parent=None,
|
|
1501
|
1501
|
label='this_is_a_page',
|
|
|
@@ -1524,7 +1524,7 @@ class TestContentApi(DefaultTest):
|
|
1524
|
1524
|
config=self.app_config,
|
|
1525
|
1525
|
)
|
|
1526
|
1526
|
|
|
1527
|
|
- content = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1527
|
+ content = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1528
|
1528
|
eq_(u1id, content.owner_id)
|
|
1529
|
1529
|
eq_(poid, content.owner_id)
|
|
1530
|
1530
|
|
|
|
@@ -1538,7 +1538,7 @@ class TestContentApi(DefaultTest):
|
|
1538
|
1538
|
session=self.session,
|
|
1539
|
1539
|
config=self.app_config,
|
|
1540
|
1540
|
)
|
|
1541
|
|
- content2 = api2.get_one(pcid, ContentType.Any, workspace)
|
|
|
1541
|
+ content2 = api2.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1542
|
1542
|
with new_revision(
|
|
1543
|
1543
|
session=self.session,
|
|
1544
|
1544
|
tm=transaction.manager,
|
|
|
@@ -1561,7 +1561,7 @@ class TestContentApi(DefaultTest):
|
|
1561
|
1561
|
config=self.app_config,
|
|
1562
|
1562
|
).get_one(wid)
|
|
1563
|
1563
|
|
|
1564
|
|
- updated = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1564
|
+ updated = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1565
|
1565
|
eq_(u2id, updated.owner_id,
|
|
1566
|
1566
|
'the owner id should be {} (found {})'.format(u2id,
|
|
1567
|
1567
|
updated.owner_id))
|
|
|
@@ -1622,7 +1622,7 @@ class TestContentApi(DefaultTest):
|
|
1622
|
1622
|
)
|
|
1623
|
1623
|
with self.session.no_autoflush:
|
|
1624
|
1624
|
page = api.create(
|
|
1625
|
|
- content_type=ContentType.Page,
|
|
|
1625
|
+ content_type_slug=CONTENT_TYPES.Page.slug,
|
|
1626
|
1626
|
workspace=workspace,
|
|
1627
|
1627
|
label="same_content",
|
|
1628
|
1628
|
do_save=False
|
|
|
@@ -1641,7 +1641,7 @@ class TestContentApi(DefaultTest):
|
|
1641
|
1641
|
session=self.session,
|
|
1642
|
1642
|
config=self.app_config,
|
|
1643
|
1643
|
)
|
|
1644
|
|
- content2 = api2.get_one(page.content_id, ContentType.Any, workspace)
|
|
|
1644
|
+ content2 = api2.get_one(page.content_id, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1645
|
1645
|
with new_revision(
|
|
1646
|
1646
|
session=self.session,
|
|
1647
|
1647
|
tm=transaction.manager,
|
|
|
@@ -1713,7 +1713,7 @@ class TestContentApi(DefaultTest):
|
|
1713
|
1713
|
config=self.app_config,
|
|
1714
|
1714
|
)
|
|
1715
|
1715
|
p = api.create(
|
|
1716
|
|
- content_type=ContentType.File,
|
|
|
1716
|
+ content_type_slug=CONTENT_TYPES.File.slug,
|
|
1717
|
1717
|
workspace=workspace,
|
|
1718
|
1718
|
parent=None,
|
|
1719
|
1719
|
label='this_is_a_page',
|
|
|
@@ -1741,7 +1741,7 @@ class TestContentApi(DefaultTest):
|
|
1741
|
1741
|
config=self.app_config,
|
|
1742
|
1742
|
).get_one(wid)
|
|
1743
|
1743
|
|
|
1744
|
|
- content = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1744
|
+ content = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1745
|
1745
|
eq_(u1id, content.owner_id)
|
|
1746
|
1746
|
eq_(poid, content.owner_id)
|
|
1747
|
1747
|
|
|
|
@@ -1757,7 +1757,7 @@ class TestContentApi(DefaultTest):
|
|
1757
|
1757
|
config=self.app_config,
|
|
1758
|
1758
|
show_archived=True,
|
|
1759
|
1759
|
)
|
|
1760
|
|
- content2 = api2.get_one(pcid, ContentType.Any, workspace)
|
|
|
1760
|
+ content2 = api2.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1761
|
1761
|
with new_revision(
|
|
1762
|
1762
|
session=self.session,
|
|
1763
|
1763
|
tm=transaction.manager,
|
|
|
@@ -1796,7 +1796,7 @@ class TestContentApi(DefaultTest):
|
|
1796
|
1796
|
show_archived=True,
|
|
1797
|
1797
|
)
|
|
1798
|
1798
|
|
|
1799
|
|
- updated = api2.get_one(pcid, ContentType.Any, workspace)
|
|
|
1799
|
+ updated = api2.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1800
|
1800
|
eq_(u2id, updated.owner_id,
|
|
1801
|
1801
|
'the owner id should be {} (found {})'.format(u2id,
|
|
1802
|
1802
|
updated.owner_id))
|
|
|
@@ -1805,7 +1805,7 @@ class TestContentApi(DefaultTest):
|
|
1805
|
1805
|
|
|
1806
|
1806
|
####
|
|
1807
|
1807
|
|
|
1808
|
|
- updated2 = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1808
|
+ updated2 = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1809
|
1809
|
with new_revision(
|
|
1810
|
1810
|
session=self.session,
|
|
1811
|
1811
|
tm=transaction.manager,
|
|
|
@@ -1874,7 +1874,7 @@ class TestContentApi(DefaultTest):
|
|
1874
|
1874
|
show_deleted=True,
|
|
1875
|
1875
|
)
|
|
1876
|
1876
|
p = api.create(
|
|
1877
|
|
- content_type=ContentType.File,
|
|
|
1877
|
+ content_type_slug=CONTENT_TYPES.File.slug,
|
|
1878
|
1878
|
workspace=workspace,
|
|
1879
|
1879
|
parent=None,
|
|
1880
|
1880
|
label='this_is_a_page',
|
|
|
@@ -1900,7 +1900,7 @@ class TestContentApi(DefaultTest):
|
|
1900
|
1900
|
config=self.app_config,
|
|
1901
|
1901
|
).get_one(wid)
|
|
1902
|
1902
|
|
|
1903
|
|
- content = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1903
|
+ content = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1904
|
1904
|
eq_(u1id, content.owner_id)
|
|
1905
|
1905
|
eq_(poid, content.owner_id)
|
|
1906
|
1906
|
|
|
|
@@ -1915,7 +1915,7 @@ class TestContentApi(DefaultTest):
|
|
1915
|
1915
|
config=self.app_config,
|
|
1916
|
1916
|
show_deleted=True,
|
|
1917
|
1917
|
)
|
|
1918
|
|
- content2 = api2.get_one(pcid, ContentType.Any, workspace)
|
|
|
1918
|
+ content2 = api2.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1919
|
1919
|
with new_revision(
|
|
1920
|
1920
|
session=self.session,
|
|
1921
|
1921
|
tm=transaction.manager,
|
|
|
@@ -1956,7 +1956,7 @@ class TestContentApi(DefaultTest):
|
|
1956
|
1956
|
show_deleted=True
|
|
1957
|
1957
|
)
|
|
1958
|
1958
|
|
|
1959
|
|
- updated = api2.get_one(pcid, ContentType.Any, workspace)
|
|
|
1959
|
+ updated = api2.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1960
|
1960
|
eq_(u2id, updated.owner_id,
|
|
1961
|
1961
|
'the owner id should be {} (found {})'.format(u2id,
|
|
1962
|
1962
|
updated.owner_id))
|
|
|
@@ -1965,7 +1965,7 @@ class TestContentApi(DefaultTest):
|
|
1965
|
1965
|
|
|
1966
|
1966
|
####
|
|
1967
|
1967
|
|
|
1968
|
|
- updated2 = api.get_one(pcid, ContentType.Any, workspace)
|
|
|
1968
|
+ updated2 = api.get_one(pcid, CONTENT_TYPES.Any_SLUG, workspace)
|
|
1969
|
1969
|
with new_revision(
|
|
1970
|
1970
|
tm=transaction.manager,
|
|
1971
|
1971
|
session=self.session,
|
|
|
@@ -2016,14 +2016,14 @@ class TestContentApi(DefaultTest):
|
|
2016
|
2016
|
session=self.session,
|
|
2017
|
2017
|
config=self.app_config,
|
|
2018
|
2018
|
)
|
|
2019
|
|
- main_folder_workspace2 = api.create(ContentType.Folder, workspace2, None, 'Hepla', '', True) # nopep8
|
|
2020
|
|
- main_folder = api.create(ContentType.Folder, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
|
2019
|
+ main_folder_workspace2 = api.create(CONTENT_TYPES.Folder.slug, workspace2, None, 'Hepla', '', True) # nopep8
|
|
|
2020
|
+ main_folder = api.create(CONTENT_TYPES.Folder.slug, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
2021
|
2021
|
# creation order test
|
|
2022
|
|
- firstly_created = api.create(ContentType.Page, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
2023
|
|
- secondly_created = api.create(ContentType.Page, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
|
2022
|
+ firstly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
|
2023
|
+ secondly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
2024
|
2024
|
# update order test
|
|
2025
|
|
- firstly_created_but_recently_updated = api.create(ContentType.Page, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
2026
|
|
- secondly_created_but_not_updated = api.create(ContentType.Page, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
|
2025
|
+ firstly_created_but_recently_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
|
2026
|
+ secondly_created_but_not_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
2027
|
2027
|
with new_revision(
|
|
2028
|
2028
|
session=self.session,
|
|
2029
|
2029
|
tm=transaction.manager,
|
|
|
@@ -2032,11 +2032,11 @@ class TestContentApi(DefaultTest):
|
|
2032
|
2032
|
firstly_created_but_recently_updated.description = 'Just an update'
|
|
2033
|
2033
|
api.save(firstly_created_but_recently_updated)
|
|
2034
|
2034
|
# comment change order
|
|
2035
|
|
- firstly_created_but_recently_commented = api.create(ContentType.Page, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
2036
|
|
- secondly_created_but_not_commented = api.create(ContentType.Page, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
|
2035
|
+ firstly_created_but_recently_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
|
2036
|
+ secondly_created_but_not_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
2037
|
2037
|
comments = api.create_comment(workspace, firstly_created_but_recently_commented, 'juste a super comment', True) # nopep8
|
|
2038
|
2038
|
|
|
2039
|
|
- content_workspace_2 = api.create(ContentType.Page, workspace2 ,main_folder_workspace2, 'content_workspace_2', '',True) # nopep8
|
|
|
2039
|
+ content_workspace_2 = api.create(CONTENT_TYPES.Page.slug, workspace2 ,main_folder_workspace2, 'content_workspace_2', '',True) # nopep8
|
|
2040
|
2040
|
last_actives = api.get_last_active()
|
|
2041
|
2041
|
assert len(last_actives) == 9
|
|
2042
|
2042
|
# workspace_2 content
|
|
|
@@ -2088,13 +2088,13 @@ class TestContentApi(DefaultTest):
|
|
2088
|
2088
|
session=self.session,
|
|
2089
|
2089
|
config=self.app_config,
|
|
2090
|
2090
|
)
|
|
2091
|
|
- main_folder = api.create(ContentType.Folder, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
|
2091
|
+ main_folder = api.create(CONTENT_TYPES.Folder.slug, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
2092
|
2092
|
# creation order test
|
|
2093
|
|
- firstly_created = api.create(ContentType.Page, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
2094
|
|
- secondly_created = api.create(ContentType.Page, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
|
2093
|
+ firstly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
|
2094
|
+ secondly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
2095
|
2095
|
# update order test
|
|
2096
|
|
- firstly_created_but_recently_updated = api.create(ContentType.Page, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
2097
|
|
- secondly_created_but_not_updated = api.create(ContentType.Page, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
|
2096
|
+ firstly_created_but_recently_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
|
2097
|
+ secondly_created_but_not_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
2098
|
2098
|
with new_revision(
|
|
2099
|
2099
|
session=self.session,
|
|
2100
|
2100
|
tm=transaction.manager,
|
|
|
@@ -2103,8 +2103,8 @@ class TestContentApi(DefaultTest):
|
|
2103
|
2103
|
firstly_created_but_recently_updated.description = 'Just an update'
|
|
2104
|
2104
|
api.save(firstly_created_but_recently_updated)
|
|
2105
|
2105
|
# comment change order
|
|
2106
|
|
- firstly_created_but_recently_commented = api.create(ContentType.Page, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
2107
|
|
- secondly_created_but_not_commented = api.create(ContentType.Page, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
|
2106
|
+ firstly_created_but_recently_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
|
2107
|
+ secondly_created_but_not_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
2108
|
2108
|
comments = api.create_comment(workspace, firstly_created_but_recently_commented, 'juste a super comment', True) # nopep8
|
|
2109
|
2109
|
|
|
2110
|
2110
|
last_actives = api.get_last_active(workspace=workspace)
|
|
|
@@ -2153,13 +2153,13 @@ class TestContentApi(DefaultTest):
|
|
2153
|
2153
|
session=self.session,
|
|
2154
|
2154
|
config=self.app_config,
|
|
2155
|
2155
|
)
|
|
2156
|
|
- main_folder = api.create(ContentType.Folder, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
|
2156
|
+ main_folder = api.create(CONTENT_TYPES.Folder.slug, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
2157
|
2157
|
# creation order test
|
|
2158
|
|
- firstly_created = api.create(ContentType.Page, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
2159
|
|
- secondly_created = api.create(ContentType.Page, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
|
2158
|
+ firstly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
|
2159
|
+ secondly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
2160
|
2160
|
# update order test
|
|
2161
|
|
- firstly_created_but_recently_updated = api.create(ContentType.Page, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
2162
|
|
- secondly_created_but_not_updated = api.create(ContentType.Page, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
|
2161
|
+ firstly_created_but_recently_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
|
2162
|
+ secondly_created_but_not_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
2163
|
2163
|
with new_revision(
|
|
2164
|
2164
|
session=self.session,
|
|
2165
|
2165
|
tm=transaction.manager,
|
|
|
@@ -2168,8 +2168,8 @@ class TestContentApi(DefaultTest):
|
|
2168
|
2168
|
firstly_created_but_recently_updated.description = 'Just an update'
|
|
2169
|
2169
|
api.save(firstly_created_but_recently_updated)
|
|
2170
|
2170
|
# comment change order
|
|
2171
|
|
- firstly_created_but_recently_commented = api.create(ContentType.Page, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
2172
|
|
- secondly_created_but_not_commented = api.create(ContentType.Page, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
|
2171
|
+ firstly_created_but_recently_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
|
2172
|
+ secondly_created_but_not_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
2173
|
2173
|
comments = api.create_comment(workspace, firstly_created_but_recently_commented, 'juste a super comment', True) # nopep8
|
|
2174
|
2174
|
|
|
2175
|
2175
|
selected_contents = [
|
|
|
@@ -2228,13 +2228,13 @@ class TestContentApi(DefaultTest):
|
|
2228
|
2228
|
session=self.session,
|
|
2229
|
2229
|
config=self.app_config,
|
|
2230
|
2230
|
)
|
|
2231
|
|
- main_folder = api.create(ContentType.Folder, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
|
2231
|
+ main_folder = api.create(CONTENT_TYPES.Folder.slug, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
2232
|
2232
|
# creation order test
|
|
2233
|
|
- firstly_created = api.create(ContentType.Page, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
2234
|
|
- secondly_created = api.create(ContentType.Page, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
|
2233
|
+ firstly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
|
2234
|
+ secondly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
2235
|
2235
|
# update order test
|
|
2236
|
|
- firstly_created_but_recently_updated = api.create(ContentType.Page, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
2237
|
|
- secondly_created_but_not_updated = api.create(ContentType.Page, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
|
2236
|
+ firstly_created_but_recently_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
|
2237
|
+ secondly_created_but_not_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
2238
|
2238
|
with new_revision(
|
|
2239
|
2239
|
session=self.session,
|
|
2240
|
2240
|
tm=transaction.manager,
|
|
|
@@ -2243,8 +2243,8 @@ class TestContentApi(DefaultTest):
|
|
2243
|
2243
|
firstly_created_but_recently_updated.description = 'Just an update'
|
|
2244
|
2244
|
api.save(firstly_created_but_recently_updated)
|
|
2245
|
2245
|
# comment change order
|
|
2246
|
|
- firstly_created_but_recently_commented = api.create(ContentType.Page, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
2247
|
|
- secondly_created_but_not_commented = api.create(ContentType.Page, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
|
2246
|
+ firstly_created_but_recently_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
|
2247
|
+ secondly_created_but_not_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
2248
|
2248
|
comments = api.create_comment(workspace, firstly_created_but_recently_commented, 'juste a super comment', True) # nopep8
|
|
2249
|
2249
|
|
|
2250
|
2250
|
last_actives = api.get_last_active(workspace=workspace, limit=2, before_datetime=datetime.datetime.now()) # nopep8
|
|
|
@@ -2309,13 +2309,13 @@ class TestContentApi(DefaultTest):
|
|
2309
|
2309
|
session=self.session,
|
|
2310
|
2310
|
config=self.app_config,
|
|
2311
|
2311
|
)
|
|
2312
|
|
- main_folder = api.create(ContentType.Folder, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
|
2312
|
+ main_folder = api.create(CONTENT_TYPES.Folder.slug, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
2313
|
2313
|
# creation order test
|
|
2314
|
|
- firstly_created = api.create(ContentType.Page, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
2315
|
|
- secondly_created = api.create(ContentType.Page, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
|
2314
|
+ firstly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
|
2315
|
+ secondly_created = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
2316
|
2316
|
# update order test
|
|
2317
|
|
- firstly_created_but_recently_updated = api.create(ContentType.Page, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
2318
|
|
- secondly_created_but_not_updated = api.create(ContentType.Page, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
|
2317
|
+ firstly_created_but_recently_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
|
2318
|
+ secondly_created_but_not_updated = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
2319
|
2319
|
with new_revision(
|
|
2320
|
2320
|
session=self.session,
|
|
2321
|
2321
|
tm=transaction.manager,
|
|
|
@@ -2324,8 +2324,8 @@ class TestContentApi(DefaultTest):
|
|
2324
|
2324
|
firstly_created_but_recently_updated.description = 'Just an update'
|
|
2325
|
2325
|
api.save(firstly_created_but_recently_updated)
|
|
2326
|
2326
|
# comment change order
|
|
2327
|
|
- firstly_created_but_recently_commented = api.create(ContentType.Page, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
2328
|
|
- secondly_created_but_not_commented = api.create(ContentType.Page, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
|
2327
|
+ firstly_created_but_recently_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
|
2328
|
+ secondly_created_but_not_commented = api.create(CONTENT_TYPES.Page.slug, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
2329
|
2329
|
comments = api.create_comment(workspace, firstly_created_but_recently_commented, 'juste a super comment', True) # nopep8
|
|
2330
|
2330
|
|
|
2331
|
2331
|
last_actives = api.get_last_active(workspace=workspace2)
|
|
|
@@ -2366,9 +2366,9 @@ class TestContentApi(DefaultTest):
|
|
2366
|
2366
|
session=self.session,
|
|
2367
|
2367
|
config=self.app_config,
|
|
2368
|
2368
|
)
|
|
2369
|
|
- a = api.create(ContentType.Folder, workspace, None,
|
|
|
2369
|
+ a = api.create(CONTENT_TYPES.Folder.slug, workspace, None,
|
|
2370
|
2370
|
'this is randomized folder', '', True)
|
|
2371
|
|
- p = api.create(ContentType.Page, workspace, a,
|
|
|
2371
|
+ p = api.create(CONTENT_TYPES.Page.slug, workspace, a,
|
|
2372
|
2372
|
'this is randomized label content', '', True)
|
|
2373
|
2373
|
|
|
2374
|
2374
|
with new_revision(
|
|
|
@@ -2422,9 +2422,9 @@ class TestContentApi(DefaultTest):
|
|
2422
|
2422
|
session=self.session,
|
|
2423
|
2423
|
config=self.app_config,
|
|
2424
|
2424
|
)
|
|
2425
|
|
- a = api.create(ContentType.Folder, workspace, None,
|
|
|
2425
|
+ a = api.create(CONTENT_TYPES.Folder.slug, workspace, None,
|
|
2426
|
2426
|
'this is randomized folder', '', True)
|
|
2427
|
|
- p = api.create(ContentType.Page, workspace, a,
|
|
|
2427
|
+ p = api.create(CONTENT_TYPES.Page.slug, workspace, a,
|
|
2428
|
2428
|
'this is dummy label content', '', True)
|
|
2429
|
2429
|
|
|
2430
|
2430
|
with new_revision(
|
|
|
@@ -2476,21 +2476,21 @@ class TestContentApi(DefaultTest):
|
|
2476
|
2476
|
config=self.app_config,
|
|
2477
|
2477
|
)
|
|
2478
|
2478
|
a = api.create(
|
|
2479
|
|
- content_type=ContentType.Folder,
|
|
|
2479
|
+ content_type_slug=CONTENT_TYPES.Folder.slug,
|
|
2480
|
2480
|
workspace=workspace,
|
|
2481
|
2481
|
parent=None,
|
|
2482
|
2482
|
label='this is randomized folder',
|
|
2483
|
2483
|
do_save=True
|
|
2484
|
2484
|
)
|
|
2485
|
2485
|
p1 = api.create(
|
|
2486
|
|
- content_type=ContentType.Page,
|
|
|
2486
|
+ content_type_slug=CONTENT_TYPES.Page.slug,
|
|
2487
|
2487
|
workspace=workspace,
|
|
2488
|
2488
|
parent=a,
|
|
2489
|
2489
|
label='this is dummy label content',
|
|
2490
|
2490
|
do_save=True
|
|
2491
|
2491
|
)
|
|
2492
|
2492
|
p2 = api.create(
|
|
2493
|
|
- content_type=ContentType.Page,
|
|
|
2493
|
+ content_type_slug=CONTENT_TYPES.Page.slug,
|
|
2494
|
2494
|
workspace=workspace,
|
|
2495
|
2495
|
parent=a,
|
|
2496
|
2496
|
label='Hey ! Jon !',
|
|
|
@@ -2540,22 +2540,22 @@ class TestContentApi(DefaultTest):
|
|
2540
|
2540
|
folder_1 = self._create_content_and_test(
|
|
2541
|
2541
|
'folder_1',
|
|
2542
|
2542
|
workspace=workspace,
|
|
2543
|
|
- type=ContentType.Folder
|
|
|
2543
|
+ type=CONTENT_TYPES.Folder.slug
|
|
2544
|
2544
|
)
|
|
2545
|
2545
|
folder_2 = self._create_content_and_test(
|
|
2546
|
2546
|
'folder_2',
|
|
2547
|
2547
|
workspace=workspace,
|
|
2548
|
|
- type=ContentType.Folder
|
|
|
2548
|
+ type=CONTENT_TYPES.Folder.slug
|
|
2549
|
2549
|
)
|
|
2550
|
2550
|
page_1 = self._create_content_and_test(
|
|
2551
|
2551
|
'foo', workspace=workspace,
|
|
2552
|
|
- type=ContentType.Page,
|
|
|
2552
|
+ type=CONTENT_TYPES.Page.slug,
|
|
2553
|
2553
|
parent=folder_1
|
|
2554
|
2554
|
)
|
|
2555
|
2555
|
page_2 = self._create_content_and_test(
|
|
2556
|
2556
|
'bar',
|
|
2557
|
2557
|
workspace=workspace,
|
|
2558
|
|
- type=ContentType.Page,
|
|
|
2558
|
+ type=CONTENT_TYPES.Page.slug,
|
|
2559
|
2559
|
parent=folder_2
|
|
2560
|
2560
|
)
|
|
2561
|
2561
|
|
|
|
@@ -2636,7 +2636,7 @@ class TestContentApiSecurity(DefaultTest):
|
|
2636
|
2636
|
session=self.session,
|
|
2637
|
2637
|
config=self.app_config,
|
|
2638
|
2638
|
).create(
|
|
2639
|
|
- content_type=ContentType.Page,
|
|
|
2639
|
+ content_type_slug=CONTENT_TYPES.Page.slug,
|
|
2640
|
2640
|
workspace=bob_workspace,
|
|
2641
|
2641
|
label='bob_page',
|
|
2642
|
2642
|
do_save=True,
|
|
|
@@ -2647,7 +2647,7 @@ class TestContentApiSecurity(DefaultTest):
|
|
2647
|
2647
|
session=self.session,
|
|
2648
|
2648
|
config=self.app_config,
|
|
2649
|
2649
|
).create(
|
|
2650
|
|
- content_type=ContentType.Page,
|
|
|
2650
|
+ content_type_slug=CONTENT_TYPES.Page.slug,
|
|
2651
|
2651
|
workspace=admin_workspace,
|
|
2652
|
2652
|
label='admin_page',
|
|
2653
|
2653
|
do_save=True,
|