|
@@ -27,7 +27,7 @@ class TestWorkspaceEndpoint(FunctionalTest):
|
27
|
27
|
)
|
28
|
28
|
res = self.testapp.get('/api/v2/workspaces/1', status=200)
|
29
|
29
|
workspace = res.json_body
|
30
|
|
- assert workspace['id'] == 1
|
|
30
|
+ assert workspace['workspace_id'] == 1
|
31
|
31
|
assert workspace['slug'] == 'business'
|
32
|
32
|
assert workspace['label'] == 'Business'
|
33
|
33
|
assert workspace['description'] == 'All importants documents'
|
|
@@ -155,10 +155,10 @@ class TestWorkspaceMembersEndpoint(FunctionalTest):
|
155
|
155
|
res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8
|
156
|
156
|
assert len(res) == 1
|
157
|
157
|
user_role = res[0]
|
158
|
|
- assert user_role['role_slug'] == 'workspace-manager'
|
|
158
|
+ assert user_role['role'] == 'workspace-manager'
|
159
|
159
|
assert user_role['user_id'] == 1
|
160
|
160
|
assert user_role['workspace_id'] == 1
|
161
|
|
- assert user_role['user']['display_name'] == 'Global manager'
|
|
161
|
+ assert user_role['user']['public_name'] == 'Global manager'
|
162
|
162
|
# TODO - G.M - 24-05-2018 - [Avatar] Replace
|
163
|
163
|
# by correct value when avatar feature will be enabled
|
164
|
164
|
assert user_role['user']['avatar_url'] is None
|
|
@@ -239,37 +239,37 @@ class TestWorkspaceContents(FunctionalTest):
|
239
|
239
|
# TODO - G.M - 30-05-2018 - Check this test
|
240
|
240
|
assert len(res) == 3
|
241
|
241
|
content = res[0]
|
242
|
|
- assert content['id'] == 1
|
|
242
|
+ assert content['content_id'] == 1
|
243
|
243
|
assert content['is_archived'] is False
|
244
|
244
|
assert content['is_deleted'] is False
|
245
|
245
|
assert content['label'] == 'Tools'
|
246
|
246
|
assert content['parent_id'] is None
|
247
|
247
|
assert content['show_in_ui'] is True
|
248
|
248
|
assert content['slug'] == 'tools'
|
249
|
|
- assert content['status_slug'] == 'open'
|
250
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
249
|
+ assert content['status'] == 'open'
|
|
250
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
251
|
251
|
assert content['workspace_id'] == 1
|
252
|
252
|
content = res[1]
|
253
|
|
- assert content['id'] == 2
|
|
253
|
+ assert content['content_id'] == 2
|
254
|
254
|
assert content['is_archived'] is False
|
255
|
255
|
assert content['is_deleted'] is False
|
256
|
256
|
assert content['label'] == 'Menus'
|
257
|
257
|
assert content['parent_id'] is None
|
258
|
258
|
assert content['show_in_ui'] is True
|
259
|
259
|
assert content['slug'] == 'menus'
|
260
|
|
- assert content['status_slug'] == 'open'
|
261
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
260
|
+ assert content['status'] == 'open'
|
|
261
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
262
|
262
|
assert content['workspace_id'] == 1
|
263
|
263
|
content = res[2]
|
264
|
|
- assert content['id'] == 11
|
|
264
|
+ assert content['content_id'] == 11
|
265
|
265
|
assert content['is_archived'] is False
|
266
|
266
|
assert content['is_deleted'] is False
|
267
|
267
|
assert content['label'] == 'Current Menu'
|
268
|
268
|
assert content['parent_id'] == 2
|
269
|
269
|
assert content['show_in_ui'] is True
|
270
|
270
|
assert content['slug'] == 'current-menu'
|
271
|
|
- assert content['status_slug'] == 'open'
|
272
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
271
|
+ assert content['status'] == 'open'
|
|
272
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
273
|
273
|
assert content['workspace_id'] == 1
|
274
|
274
|
|
275
|
275
|
# Root related
|
|
@@ -299,42 +299,42 @@ class TestWorkspaceContents(FunctionalTest):
|
299
|
299
|
# TODO - G.M - 30-05-2018 - Check this test
|
300
|
300
|
assert len(res) == 4
|
301
|
301
|
content = res[1]
|
302
|
|
- assert content['content_type_slug'] == 'page'
|
303
|
|
- assert content['id'] == 15
|
|
302
|
+ assert content['content_type'] == 'page'
|
|
303
|
+ assert content['content_id'] == 15
|
304
|
304
|
assert content['is_archived'] is False
|
305
|
305
|
assert content['is_deleted'] is False
|
306
|
306
|
assert content['label'] == 'New Fruit Salad'
|
307
|
307
|
assert content['parent_id'] is None
|
308
|
308
|
assert content['show_in_ui'] is True
|
309
|
309
|
assert content['slug'] == 'new-fruit-salad'
|
310
|
|
- assert content['status_slug'] == 'open'
|
311
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
310
|
+ assert content['status'] == 'open'
|
|
311
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
312
|
312
|
assert content['workspace_id'] == 3
|
313
|
313
|
|
314
|
314
|
content = res[2]
|
315
|
|
- assert content['content_type_slug'] == 'page'
|
316
|
|
- assert content['id'] == 16
|
|
315
|
+ assert content['content_type'] == 'page'
|
|
316
|
+ assert content['content_id'] == 16
|
317
|
317
|
assert content['is_archived'] is True
|
318
|
318
|
assert content['is_deleted'] is False
|
319
|
319
|
assert content['label'].startswith('Fruit Salad')
|
320
|
320
|
assert content['parent_id'] is None
|
321
|
321
|
assert content['show_in_ui'] is True
|
322
|
322
|
assert content['slug'].startswith('fruit-salad')
|
323
|
|
- assert content['status_slug'] == 'open'
|
324
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
323
|
+ assert content['status'] == 'open'
|
|
324
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
325
|
325
|
assert content['workspace_id'] == 3
|
326
|
326
|
|
327
|
327
|
content = res[3]
|
328
|
|
- assert content['content_type_slug'] == 'page'
|
329
|
|
- assert content['id'] == 17
|
|
328
|
+ assert content['content_type'] == 'page'
|
|
329
|
+ assert content['content_id'] == 17
|
330
|
330
|
assert content['is_archived'] is False
|
331
|
331
|
assert content['is_deleted'] is True
|
332
|
332
|
assert content['label'].startswith('Bad Fruit Salad')
|
333
|
333
|
assert content['parent_id'] is None
|
334
|
334
|
assert content['show_in_ui'] is True
|
335
|
335
|
assert content['slug'].startswith('bad-fruit-salad')
|
336
|
|
- assert content['status_slug'] == 'open'
|
337
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
336
|
+ assert content['status'] == 'open'
|
|
337
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
338
|
338
|
assert content['workspace_id'] == 3
|
339
|
339
|
|
340
|
340
|
def test_api__get_workspace_content__ok_200__get_only_active_root_content(self): # nopep8
|
|
@@ -362,16 +362,16 @@ class TestWorkspaceContents(FunctionalTest):
|
362
|
362
|
# TODO - G.M - 30-05-2018 - Check this test
|
363
|
363
|
assert len(res) == 2
|
364
|
364
|
content = res[1]
|
365
|
|
- assert content['content_type_slug'] == 'page'
|
366
|
|
- assert content['id'] == 15
|
|
365
|
+ assert content['content_type'] == 'page'
|
|
366
|
+ assert content['content_id'] == 15
|
367
|
367
|
assert content['is_archived'] is False
|
368
|
368
|
assert content['is_deleted'] is False
|
369
|
369
|
assert content['label'] == 'New Fruit Salad'
|
370
|
370
|
assert content['parent_id'] is None
|
371
|
371
|
assert content['show_in_ui'] is True
|
372
|
372
|
assert content['slug'] == 'new-fruit-salad'
|
373
|
|
- assert content['status_slug'] == 'open'
|
374
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
373
|
+ assert content['status'] == 'open'
|
|
374
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
375
|
375
|
assert content['workspace_id'] == 3
|
376
|
376
|
|
377
|
377
|
def test_api__get_workspace_content__ok_200__get_only_archived_root_content(self): # nopep8
|
|
@@ -398,16 +398,16 @@ class TestWorkspaceContents(FunctionalTest):
|
398
|
398
|
).json_body # nopep8
|
399
|
399
|
assert len(res) == 1
|
400
|
400
|
content = res[0]
|
401
|
|
- assert content['content_type_slug'] == 'page'
|
402
|
|
- assert content['id'] == 16
|
|
401
|
+ assert content['content_type'] == 'page'
|
|
402
|
+ assert content['content_id'] == 16
|
403
|
403
|
assert content['is_archived'] is True
|
404
|
404
|
assert content['is_deleted'] is False
|
405
|
405
|
assert content['label'].startswith('Fruit Salad')
|
406
|
406
|
assert content['parent_id'] is None
|
407
|
407
|
assert content['show_in_ui'] is True
|
408
|
408
|
assert content['slug'].startswith('fruit-salad')
|
409
|
|
- assert content['status_slug'] == 'open'
|
410
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
409
|
+ assert content['status'] == 'open'
|
|
410
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
411
|
411
|
assert content['workspace_id'] == 3
|
412
|
412
|
|
413
|
413
|
def test_api__get_workspace_content__ok_200__get_only_deleted_root_content(self): # nopep8
|
|
@@ -436,16 +436,16 @@ class TestWorkspaceContents(FunctionalTest):
|
436
|
436
|
|
437
|
437
|
assert len(res) == 1
|
438
|
438
|
content = res[0]
|
439
|
|
- assert content['content_type_slug'] == 'page'
|
440
|
|
- assert content['id'] == 17
|
|
439
|
+ assert content['content_type'] == 'page'
|
|
440
|
+ assert content['content_id'] == 17
|
441
|
441
|
assert content['is_archived'] is False
|
442
|
442
|
assert content['is_deleted'] is True
|
443
|
443
|
assert content['label'].startswith('Bad Fruit Salad')
|
444
|
444
|
assert content['parent_id'] is None
|
445
|
445
|
assert content['show_in_ui'] is True
|
446
|
446
|
assert content['slug'].startswith('bad-fruit-salad')
|
447
|
|
- assert content['status_slug'] == 'open'
|
448
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
447
|
+ assert content['status'] == 'open'
|
|
448
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
449
|
449
|
assert content['workspace_id'] == 3
|
450
|
450
|
|
451
|
451
|
def test_api__get_workspace_content__ok_200__get_nothing_root_content(self):
|
|
@@ -500,42 +500,42 @@ class TestWorkspaceContents(FunctionalTest):
|
500
|
500
|
).json_body # nopep8
|
501
|
501
|
assert len(res) == 3
|
502
|
502
|
content = res[0]
|
503
|
|
- assert content['content_type_slug'] == 'page'
|
504
|
|
- assert content['id'] == 12
|
|
503
|
+ assert content['content_type'] == 'page'
|
|
504
|
+ assert content['content_id'] == 12
|
505
|
505
|
assert content['is_archived'] is False
|
506
|
506
|
assert content['is_deleted'] is False
|
507
|
507
|
assert content['label'] == 'New Fruit Salad'
|
508
|
508
|
assert content['parent_id'] == 10
|
509
|
509
|
assert content['show_in_ui'] is True
|
510
|
510
|
assert content['slug'] == 'new-fruit-salad'
|
511
|
|
- assert content['status_slug'] == 'open'
|
512
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
511
|
+ assert content['status'] == 'open'
|
|
512
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
513
|
513
|
assert content['workspace_id'] == 2
|
514
|
514
|
|
515
|
515
|
content = res[1]
|
516
|
|
- assert content['content_type_slug'] == 'page'
|
517
|
|
- assert content['id'] == 13
|
|
516
|
+ assert content['content_type'] == 'page'
|
|
517
|
+ assert content['content_id'] == 13
|
518
|
518
|
assert content['is_archived'] is True
|
519
|
519
|
assert content['is_deleted'] is False
|
520
|
520
|
assert content['label'].startswith('Fruit Salad')
|
521
|
521
|
assert content['parent_id'] == 10
|
522
|
522
|
assert content['show_in_ui'] is True
|
523
|
523
|
assert content['slug'].startswith('fruit-salad')
|
524
|
|
- assert content['status_slug'] == 'open'
|
525
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
524
|
+ assert content['status'] == 'open'
|
|
525
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
526
|
526
|
assert content['workspace_id'] == 2
|
527
|
527
|
|
528
|
528
|
content = res[2]
|
529
|
|
- assert content['content_type_slug'] == 'page'
|
530
|
|
- assert content['id'] == 14
|
|
529
|
+ assert content['content_type'] == 'page'
|
|
530
|
+ assert content['content_id'] == 14
|
531
|
531
|
assert content['is_archived'] is False
|
532
|
532
|
assert content['is_deleted'] is True
|
533
|
533
|
assert content['label'].startswith('Bad Fruit Salad')
|
534
|
534
|
assert content['parent_id'] == 10
|
535
|
535
|
assert content['show_in_ui'] is True
|
536
|
536
|
assert content['slug'].startswith('bad-fruit-salad')
|
537
|
|
- assert content['status_slug'] == 'open'
|
538
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
537
|
+ assert content['status'] == 'open'
|
|
538
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
539
|
539
|
assert content['workspace_id'] == 2
|
540
|
540
|
|
541
|
541
|
def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self): # nopep8
|
|
@@ -562,16 +562,16 @@ class TestWorkspaceContents(FunctionalTest):
|
562
|
562
|
).json_body # nopep8
|
563
|
563
|
assert len(res) == 1
|
564
|
564
|
content = res[0]
|
565
|
|
- assert content['content_type_slug']
|
566
|
|
- assert content['id'] == 12
|
|
565
|
+ assert content['content_type']
|
|
566
|
+ assert content['content_id'] == 12
|
567
|
567
|
assert content['is_archived'] is False
|
568
|
568
|
assert content['is_deleted'] is False
|
569
|
569
|
assert content['label'] == 'New Fruit Salad'
|
570
|
570
|
assert content['parent_id'] == 10
|
571
|
571
|
assert content['show_in_ui'] is True
|
572
|
572
|
assert content['slug'] == 'new-fruit-salad'
|
573
|
|
- assert content['status_slug'] == 'open'
|
574
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
573
|
+ assert content['status'] == 'open'
|
|
574
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
575
|
575
|
assert content['workspace_id'] == 2
|
576
|
576
|
|
577
|
577
|
def test_api__get_workspace_content__ok_200__get_only_archived_folder_content(self): # nopep8
|
|
@@ -598,16 +598,16 @@ class TestWorkspaceContents(FunctionalTest):
|
598
|
598
|
).json_body # nopep8
|
599
|
599
|
assert len(res) == 1
|
600
|
600
|
content = res[0]
|
601
|
|
- assert content['content_type_slug'] == 'page'
|
602
|
|
- assert content['id'] == 13
|
|
601
|
+ assert content['content_type'] == 'page'
|
|
602
|
+ assert content['content_id'] == 13
|
603
|
603
|
assert content['is_archived'] is True
|
604
|
604
|
assert content['is_deleted'] is False
|
605
|
605
|
assert content['label'].startswith('Fruit Salad')
|
606
|
606
|
assert content['parent_id'] == 10
|
607
|
607
|
assert content['show_in_ui'] is True
|
608
|
608
|
assert content['slug'].startswith('fruit-salad')
|
609
|
|
- assert content['status_slug'] == 'open'
|
610
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
609
|
+ assert content['status'] == 'open'
|
|
610
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
611
|
611
|
assert content['workspace_id'] == 2
|
612
|
612
|
|
613
|
613
|
def test_api__get_workspace_content__ok_200__get_only_deleted_folder_content(self): # nopep8
|
|
@@ -635,16 +635,16 @@ class TestWorkspaceContents(FunctionalTest):
|
635
|
635
|
|
636
|
636
|
assert len(res) == 1
|
637
|
637
|
content = res[0]
|
638
|
|
- assert content['content_type_slug'] == 'page'
|
639
|
|
- assert content['id'] == 14
|
|
638
|
+ assert content['content_type'] == 'page'
|
|
639
|
+ assert content['content_id'] == 14
|
640
|
640
|
assert content['is_archived'] is False
|
641
|
641
|
assert content['is_deleted'] is True
|
642
|
642
|
assert content['label'].startswith('Bad Fruit Salad')
|
643
|
643
|
assert content['parent_id'] == 10
|
644
|
644
|
assert content['show_in_ui'] is True
|
645
|
645
|
assert content['slug'].startswith('bad-fruit-salad')
|
646
|
|
- assert content['status_slug'] == 'open'
|
647
|
|
- assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
|
646
|
+ assert content['status'] == 'open'
|
|
647
|
+ assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
648
|
648
|
assert content['workspace_id'] == 2
|
649
|
649
|
|
650
|
650
|
def test_api__get_workspace_content__ok_200__get_nothing_folder_content(self): # nopep8
|
|
@@ -741,7 +741,7 @@ class TestWorkspaceContents(FunctionalTest):
|
741
|
741
|
)
|
742
|
742
|
params = {
|
743
|
743
|
'label': 'GenericCreatedContent',
|
744
|
|
- 'content_type_slug': 'markdownpage',
|
|
744
|
+ 'content_type': 'markdownpage',
|
745
|
745
|
}
|
746
|
746
|
res = self.testapp.post_json(
|
747
|
747
|
'/api/v2/workspaces/1/contents',
|
|
@@ -750,16 +750,16 @@ class TestWorkspaceContents(FunctionalTest):
|
750
|
750
|
)
|
751
|
751
|
assert res
|
752
|
752
|
assert res.json_body
|
753
|
|
- assert res.json_body['status_slug'] == 'open'
|
754
|
|
- assert res.json_body['id']
|
755
|
|
- assert res.json_body['content_type_slug'] == 'markdownpage'
|
|
753
|
+ assert res.json_body['status'] == 'open'
|
|
754
|
+ assert res.json_body['content_id']
|
|
755
|
+ assert res.json_body['content_type'] == 'markdownpage'
|
756
|
756
|
assert res.json_body['is_archived'] is False
|
757
|
757
|
assert res.json_body['is_deleted'] is False
|
758
|
758
|
assert res.json_body['workspace_id'] == 1
|
759
|
759
|
assert res.json_body['slug'] == 'genericcreatedcontent'
|
760
|
760
|
assert res.json_body['parent_id'] is None
|
761
|
761
|
assert res.json_body['show_in_ui'] is True
|
762
|
|
- assert res.json_body['sub_content_type_slug']
|
|
762
|
+ assert res.json_body['sub_content_types']
|
763
|
763
|
params_active = {
|
764
|
764
|
'parent_id': 0,
|
765
|
765
|
'show_archived': 0,
|
|
@@ -786,6 +786,7 @@ class TestWorkspaceContents(FunctionalTest):
|
786
|
786
|
)
|
787
|
787
|
params = {
|
788
|
788
|
'new_parent_id': '4', # Salads
|
|
789
|
+ 'new_workspace_id': '2',
|
789
|
790
|
}
|
790
|
791
|
params_folder1 = {
|
791
|
792
|
'parent_id': 3,
|
|
@@ -801,8 +802,8 @@ class TestWorkspaceContents(FunctionalTest):
|
801
|
802
|
}
|
802
|
803
|
folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
803
|
804
|
folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
804
|
|
- assert [content for content in folder1_contents if content['id'] == 8] # nopep8
|
805
|
|
- assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
|
|
805
|
+ assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8
|
|
806
|
+ assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8
|
806
|
807
|
# TODO - G.M - 2018-06-163 - Check content
|
807
|
808
|
res = self.testapp.put_json(
|
808
|
809
|
'/api/v2/workspaces/2/contents/8/move',
|
|
@@ -811,8 +812,245 @@ class TestWorkspaceContents(FunctionalTest):
|
811
|
812
|
)
|
812
|
813
|
new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
813
|
814
|
new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
814
|
|
- assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
|
815
|
|
- assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
|
|
815
|
+ assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8
|
|
816
|
+ assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8
|
|
817
|
+ assert res.json_body
|
|
818
|
+ assert res.json_body['parent_id'] == 4
|
|
819
|
+ assert res.json_body['content_id'] == 8
|
|
820
|
+ assert res.json_body['workspace_id'] == 2
|
|
821
|
+
|
|
822
|
+ def test_api_put_move_content__ok_200__to_root(self):
|
|
823
|
+ """
|
|
824
|
+ Move content
|
|
825
|
+ move Apple_Pie (content_id: 8)
|
|
826
|
+ from Desserts folder(content_id: 3) to root (content_id: 0)
|
|
827
|
+ of workspace Recipes.
|
|
828
|
+ """
|
|
829
|
+ self.testapp.authorization = (
|
|
830
|
+ 'Basic',
|
|
831
|
+ (
|
|
832
|
+ 'admin@admin.admin',
|
|
833
|
+ 'admin@admin.admin'
|
|
834
|
+ )
|
|
835
|
+ )
|
|
836
|
+ params = {
|
|
837
|
+ 'new_parent_id': None, # root
|
|
838
|
+ 'new_workspace_id': 2,
|
|
839
|
+ }
|
|
840
|
+ params_folder1 = {
|
|
841
|
+ 'parent_id': 3,
|
|
842
|
+ 'show_archived': 0,
|
|
843
|
+ 'show_deleted': 0,
|
|
844
|
+ 'show_active': 1,
|
|
845
|
+ }
|
|
846
|
+ params_folder2 = {
|
|
847
|
+ 'parent_id': 0,
|
|
848
|
+ 'show_archived': 0,
|
|
849
|
+ 'show_deleted': 0,
|
|
850
|
+ 'show_active': 1,
|
|
851
|
+ }
|
|
852
|
+ folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
853
|
+ folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
|
854
|
+ assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8
|
|
855
|
+ assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8
|
|
856
|
+ # TODO - G.M - 2018-06-163 - Check content
|
|
857
|
+ res = self.testapp.put_json(
|
|
858
|
+ '/api/v2/workspaces/2/contents/8/move',
|
|
859
|
+ params=params,
|
|
860
|
+ status=200
|
|
861
|
+ )
|
|
862
|
+ new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
863
|
+ new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
|
864
|
+ assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8
|
|
865
|
+ assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8
|
|
866
|
+ assert res.json_body
|
|
867
|
+ assert res.json_body['parent_id'] is None
|
|
868
|
+ assert res.json_body['content_id'] == 8
|
|
869
|
+ assert res.json_body['workspace_id'] == 2
|
|
870
|
+
|
|
871
|
+ def test_api_put_move_content__ok_200__with_workspace_id(self):
|
|
872
|
+ """
|
|
873
|
+ Move content
|
|
874
|
+ move Apple_Pie (content_id: 8)
|
|
875
|
+ from Desserts folder(content_id: 3) to Salads subfolder (content_id: 4)
|
|
876
|
+ of workspace Recipes.
|
|
877
|
+ """
|
|
878
|
+ self.testapp.authorization = (
|
|
879
|
+ 'Basic',
|
|
880
|
+ (
|
|
881
|
+ 'admin@admin.admin',
|
|
882
|
+ 'admin@admin.admin'
|
|
883
|
+ )
|
|
884
|
+ )
|
|
885
|
+ params = {
|
|
886
|
+ 'new_parent_id': '4', # Salads
|
|
887
|
+ 'new_workspace_id': '2',
|
|
888
|
+ }
|
|
889
|
+ params_folder1 = {
|
|
890
|
+ 'parent_id': 3,
|
|
891
|
+ 'show_archived': 0,
|
|
892
|
+ 'show_deleted': 0,
|
|
893
|
+ 'show_active': 1,
|
|
894
|
+ }
|
|
895
|
+ params_folder2 = {
|
|
896
|
+ 'parent_id': 4,
|
|
897
|
+ 'show_archived': 0,
|
|
898
|
+ 'show_deleted': 0,
|
|
899
|
+ 'show_active': 1,
|
|
900
|
+ }
|
|
901
|
+ folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
902
|
+ folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
|
903
|
+ assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8
|
|
904
|
+ assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8
|
|
905
|
+ # TODO - G.M - 2018-06-163 - Check content
|
|
906
|
+ res = self.testapp.put_json(
|
|
907
|
+ '/api/v2/workspaces/2/contents/8/move',
|
|
908
|
+ params=params,
|
|
909
|
+ status=200
|
|
910
|
+ )
|
|
911
|
+ new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
912
|
+ new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
|
913
|
+ assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8
|
|
914
|
+ assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8
|
|
915
|
+ assert res.json_body
|
|
916
|
+ assert res.json_body['parent_id'] == 4
|
|
917
|
+ assert res.json_body['content_id'] == 8
|
|
918
|
+ assert res.json_body['workspace_id'] == 2
|
|
919
|
+
|
|
920
|
+ def test_api_put_move_content__ok_200__to_another_workspace(self):
|
|
921
|
+ """
|
|
922
|
+ Move content
|
|
923
|
+ move Apple_Pie (content_id: 8)
|
|
924
|
+ from Desserts folder(content_id: 3) to Menus subfolder (content_id: 2)
|
|
925
|
+ of workspace Business.
|
|
926
|
+ """
|
|
927
|
+ self.testapp.authorization = (
|
|
928
|
+ 'Basic',
|
|
929
|
+ (
|
|
930
|
+ 'admin@admin.admin',
|
|
931
|
+ 'admin@admin.admin'
|
|
932
|
+ )
|
|
933
|
+ )
|
|
934
|
+ params = {
|
|
935
|
+ 'new_parent_id': '2', # Menus
|
|
936
|
+ 'new_workspace_id': '1',
|
|
937
|
+ }
|
|
938
|
+ params_folder1 = {
|
|
939
|
+ 'parent_id': 3,
|
|
940
|
+ 'show_archived': 0,
|
|
941
|
+ 'show_deleted': 0,
|
|
942
|
+ 'show_active': 1,
|
|
943
|
+ }
|
|
944
|
+ params_folder2 = {
|
|
945
|
+ 'parent_id': 2,
|
|
946
|
+ 'show_archived': 0,
|
|
947
|
+ 'show_deleted': 0,
|
|
948
|
+ 'show_active': 1,
|
|
949
|
+ }
|
|
950
|
+ folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
951
|
+ folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
|
|
952
|
+ assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8
|
|
953
|
+ assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8
|
|
954
|
+ # TODO - G.M - 2018-06-163 - Check content
|
|
955
|
+ res = self.testapp.put_json(
|
|
956
|
+ '/api/v2/workspaces/2/contents/8/move',
|
|
957
|
+ params=params,
|
|
958
|
+ status=200
|
|
959
|
+ )
|
|
960
|
+ new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
961
|
+ new_folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
|
|
962
|
+ assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8
|
|
963
|
+ assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8
|
|
964
|
+ assert res.json_body
|
|
965
|
+ assert res.json_body['parent_id'] == 2
|
|
966
|
+ assert res.json_body['content_id'] == 8
|
|
967
|
+ assert res.json_body['workspace_id'] == 1
|
|
968
|
+
|
|
969
|
+ def test_api_put_move_content__ok_200__to_another_workspace_root(self):
|
|
970
|
+ """
|
|
971
|
+ Move content
|
|
972
|
+ move Apple_Pie (content_id: 8)
|
|
973
|
+ from Desserts folder(content_id: 3) to root (content_id: 0)
|
|
974
|
+ of workspace Business.
|
|
975
|
+ """
|
|
976
|
+ self.testapp.authorization = (
|
|
977
|
+ 'Basic',
|
|
978
|
+ (
|
|
979
|
+ 'admin@admin.admin',
|
|
980
|
+ 'admin@admin.admin'
|
|
981
|
+ )
|
|
982
|
+ )
|
|
983
|
+ params = {
|
|
984
|
+ 'new_parent_id': None, # root
|
|
985
|
+ 'new_workspace_id': '1',
|
|
986
|
+ }
|
|
987
|
+ params_folder1 = {
|
|
988
|
+ 'parent_id': 3,
|
|
989
|
+ 'show_archived': 0,
|
|
990
|
+ 'show_deleted': 0,
|
|
991
|
+ 'show_active': 1,
|
|
992
|
+ }
|
|
993
|
+ params_folder2 = {
|
|
994
|
+ 'parent_id': 0,
|
|
995
|
+ 'show_archived': 0,
|
|
996
|
+ 'show_deleted': 0,
|
|
997
|
+ 'show_active': 1,
|
|
998
|
+ }
|
|
999
|
+ folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
1000
|
+ folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
|
|
1001
|
+ assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8
|
|
1002
|
+ assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8
|
|
1003
|
+ # TODO - G.M - 2018-06-163 - Check content
|
|
1004
|
+ res = self.testapp.put_json(
|
|
1005
|
+ '/api/v2/workspaces/2/contents/8/move',
|
|
1006
|
+ params=params,
|
|
1007
|
+ status=200
|
|
1008
|
+ )
|
|
1009
|
+ new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
|
1010
|
+ new_folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
|
|
1011
|
+ assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8
|
|
1012
|
+ assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8
|
|
1013
|
+ assert res.json_body
|
|
1014
|
+ assert res.json_body['parent_id'] is None
|
|
1015
|
+ assert res.json_body['content_id'] == 8
|
|
1016
|
+ assert res.json_body['workspace_id'] == 1
|
|
1017
|
+
|
|
1018
|
+ def test_api_put_move_content__err_400__wrong_workspace_id(self):
|
|
1019
|
+ """
|
|
1020
|
+ Move content
|
|
1021
|
+ move Apple_Pie (content_id: 8)
|
|
1022
|
+ from Desserts folder(content_id: 3) to Salads subfolder (content_id: 4)
|
|
1023
|
+ of workspace Recipes.
|
|
1024
|
+ Workspace_id of parent_id don't match with workspace_id of workspace
|
|
1025
|
+ """
|
|
1026
|
+ self.testapp.authorization = (
|
|
1027
|
+ 'Basic',
|
|
1028
|
+ (
|
|
1029
|
+ 'admin@admin.admin',
|
|
1030
|
+ 'admin@admin.admin'
|
|
1031
|
+ )
|
|
1032
|
+ )
|
|
1033
|
+ params = {
|
|
1034
|
+ 'new_parent_id': '4', # Salads
|
|
1035
|
+ 'new_workspace_id': '1',
|
|
1036
|
+ }
|
|
1037
|
+ params_folder1 = {
|
|
1038
|
+ 'parent_id': 3,
|
|
1039
|
+ 'show_archived': 0,
|
|
1040
|
+ 'show_deleted': 0,
|
|
1041
|
+ 'show_active': 1,
|
|
1042
|
+ }
|
|
1043
|
+ params_folder2 = {
|
|
1044
|
+ 'parent_id': 4,
|
|
1045
|
+ 'show_archived': 0,
|
|
1046
|
+ 'show_deleted': 0,
|
|
1047
|
+ 'show_active': 1,
|
|
1048
|
+ }
|
|
1049
|
+ res = self.testapp.put_json(
|
|
1050
|
+ '/api/v2/workspaces/2/contents/8/move',
|
|
1051
|
+ params=params,
|
|
1052
|
+ status=400,
|
|
1053
|
+ )
|
816
|
1054
|
|
817
|
1055
|
def test_api_put_delete_content__ok_200__nominal_case(self):
|
818
|
1056
|
"""
|
|
@@ -840,18 +1078,18 @@ class TestWorkspaceContents(FunctionalTest):
|
840
|
1078
|
}
|
841
|
1079
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
842
|
1080
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
843
|
|
- assert [content for content in active_contents if content['id'] == 8] # nopep8
|
844
|
|
- assert not [content for content in deleted_contents if content['id'] == 8] # nopep8
|
|
1081
|
+ assert [content for content in active_contents if content['content_id'] == 8] # nopep8
|
|
1082
|
+ assert not [content for content in deleted_contents if content['content_id'] == 8] # nopep8
|
845
|
1083
|
# TODO - G.M - 2018-06-163 - Check content
|
846
|
1084
|
res = self.testapp.put_json(
|
847
|
1085
|
# INFO - G.M - 2018-06-163 - delete Apple_Pie
|
848
|
1086
|
'/api/v2/workspaces/2/contents/8/delete',
|
849
|
|
- status=200
|
|
1087
|
+ status=204
|
850
|
1088
|
)
|
851
|
1089
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
852
|
1090
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
853
|
|
- assert not [content for content in new_active_contents if content['id'] == 8] # nopep8
|
854
|
|
- assert [content for content in new_deleted_contents if content['id'] == 8] # nopep8
|
|
1091
|
+ assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8
|
|
1092
|
+ assert [content for content in new_deleted_contents if content['content_id'] == 8] # nopep8
|
855
|
1093
|
|
856
|
1094
|
def test_api_put_archive_content__ok_200__nominal_case(self):
|
857
|
1095
|
"""
|
|
@@ -879,16 +1117,16 @@ class TestWorkspaceContents(FunctionalTest):
|
879
|
1117
|
}
|
880
|
1118
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
881
|
1119
|
archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
882
|
|
- assert [content for content in active_contents if content['id'] == 8] # nopep8
|
883
|
|
- assert not [content for content in archived_contents if content['id'] == 8] # nopep8
|
|
1120
|
+ assert [content for content in active_contents if content['content_id'] == 8] # nopep8
|
|
1121
|
+ assert not [content for content in archived_contents if content['content_id'] == 8] # nopep8
|
884
|
1122
|
res = self.testapp.put_json(
|
885
|
1123
|
'/api/v2/workspaces/2/contents/8/archive',
|
886
|
|
- status=200
|
|
1124
|
+ status=204
|
887
|
1125
|
)
|
888
|
1126
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
889
|
1127
|
new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
890
|
|
- assert not [content for content in new_active_contents if content['id'] == 8] # nopep8
|
891
|
|
- assert [content for content in new_archived_contents if content['id'] == 8] # nopep8
|
|
1128
|
+ assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8
|
|
1129
|
+ assert [content for content in new_archived_contents if content['content_id'] == 8] # nopep8
|
892
|
1130
|
|
893
|
1131
|
def test_api_put_undelete_content__ok_200__nominal_case(self):
|
894
|
1132
|
"""
|
|
@@ -916,16 +1154,16 @@ class TestWorkspaceContents(FunctionalTest):
|
916
|
1154
|
}
|
917
|
1155
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
918
|
1156
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
919
|
|
- assert not [content for content in active_contents if content['id'] == 14] # nopep8
|
920
|
|
- assert [content for content in deleted_contents if content['id'] == 14] # nopep8
|
|
1157
|
+ assert not [content for content in active_contents if content['content_id'] == 14] # nopep8
|
|
1158
|
+ assert [content for content in deleted_contents if content['content_id'] == 14] # nopep8
|
921
|
1159
|
res = self.testapp.put_json(
|
922
|
1160
|
'/api/v2/workspaces/2/contents/14/undelete',
|
923
|
|
- status=200
|
|
1161
|
+ status=204
|
924
|
1162
|
)
|
925
|
1163
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
926
|
1164
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
927
|
|
- assert [content for content in new_active_contents if content['id'] == 14] # nopep8
|
928
|
|
- assert not [content for content in new_deleted_contents if content['id'] == 14] # nopep8
|
|
1165
|
+ assert [content for content in new_active_contents if content['content_id'] == 14] # nopep8
|
|
1166
|
+ assert not [content for content in new_deleted_contents if content['content_id'] == 14] # nopep8
|
929
|
1167
|
|
930
|
1168
|
def test_api_put_unarchive_content__ok_200__nominal_case(self):
|
931
|
1169
|
"""
|
|
@@ -953,13 +1191,13 @@ class TestWorkspaceContents(FunctionalTest):
|
953
|
1191
|
}
|
954
|
1192
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
955
|
1193
|
archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
956
|
|
- assert not [content for content in active_contents if content['id'] == 13] # nopep8
|
957
|
|
- assert [content for content in archived_contents if content['id'] == 13] # nopep8
|
|
1194
|
+ assert not [content for content in active_contents if content['content_id'] == 13] # nopep8
|
|
1195
|
+ assert [content for content in archived_contents if content['content_id'] == 13] # nopep8
|
958
|
1196
|
res = self.testapp.put_json(
|
959
|
1197
|
'/api/v2/workspaces/2/contents/13/unarchive',
|
960
|
|
- status=200
|
|
1198
|
+ status=204
|
961
|
1199
|
)
|
962
|
1200
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
963
|
1201
|
new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
964
|
|
- assert [content for content in new_active_contents if content['id'] == 13] # nopep8
|
965
|
|
- assert not [content for content in new_archived_contents if content['id'] == 13] # nopep8
|
|
1202
|
+ assert [content for content in new_active_contents if content['content_id'] == 13] # nopep8
|
|
1203
|
+ assert not [content for content in new_archived_contents if content['content_id'] == 13] # nopep8
|