|
@@ -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'
|
|
@@ -239,7 +239,7 @@ 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'
|
|
@@ -250,7 +250,7 @@ class TestWorkspaceContents(FunctionalTest):
|
250
|
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'
|
|
@@ -261,7 +261,7 @@ class TestWorkspaceContents(FunctionalTest):
|
261
|
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'
|
|
@@ -300,7 +300,7 @@ class TestWorkspaceContents(FunctionalTest):
|
300
|
300
|
assert len(res) == 4
|
301
|
301
|
content = res[1]
|
302
|
302
|
assert content['content_type'] == 'page'
|
303
|
|
- assert content['id'] == 15
|
|
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'
|
|
@@ -313,7 +313,7 @@ class TestWorkspaceContents(FunctionalTest):
|
313
|
313
|
|
314
|
314
|
content = res[2]
|
315
|
315
|
assert content['content_type'] == 'page'
|
316
|
|
- assert content['id'] == 16
|
|
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')
|
|
@@ -326,7 +326,7 @@ class TestWorkspaceContents(FunctionalTest):
|
326
|
326
|
|
327
|
327
|
content = res[3]
|
328
|
328
|
assert content['content_type'] == 'page'
|
329
|
|
- assert content['id'] == 17
|
|
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')
|
|
@@ -363,7 +363,7 @@ class TestWorkspaceContents(FunctionalTest):
|
363
|
363
|
assert len(res) == 2
|
364
|
364
|
content = res[1]
|
365
|
365
|
assert content['content_type'] == 'page'
|
366
|
|
- assert content['id'] == 15
|
|
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'
|
|
@@ -399,7 +399,7 @@ class TestWorkspaceContents(FunctionalTest):
|
399
|
399
|
assert len(res) == 1
|
400
|
400
|
content = res[0]
|
401
|
401
|
assert content['content_type'] == 'page'
|
402
|
|
- assert content['id'] == 16
|
|
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')
|
|
@@ -437,7 +437,7 @@ class TestWorkspaceContents(FunctionalTest):
|
437
|
437
|
assert len(res) == 1
|
438
|
438
|
content = res[0]
|
439
|
439
|
assert content['content_type'] == 'page'
|
440
|
|
- assert content['id'] == 17
|
|
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')
|
|
@@ -501,7 +501,7 @@ class TestWorkspaceContents(FunctionalTest):
|
501
|
501
|
assert len(res) == 3
|
502
|
502
|
content = res[0]
|
503
|
503
|
assert content['content_type'] == 'page'
|
504
|
|
- assert content['id'] == 12
|
|
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'
|
|
@@ -514,7 +514,7 @@ class TestWorkspaceContents(FunctionalTest):
|
514
|
514
|
|
515
|
515
|
content = res[1]
|
516
|
516
|
assert content['content_type'] == 'page'
|
517
|
|
- assert content['id'] == 13
|
|
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')
|
|
@@ -527,7 +527,7 @@ class TestWorkspaceContents(FunctionalTest):
|
527
|
527
|
|
528
|
528
|
content = res[2]
|
529
|
529
|
assert content['content_type'] == 'page'
|
530
|
|
- assert content['id'] == 14
|
|
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')
|
|
@@ -563,7 +563,7 @@ class TestWorkspaceContents(FunctionalTest):
|
563
|
563
|
assert len(res) == 1
|
564
|
564
|
content = res[0]
|
565
|
565
|
assert content['content_type']
|
566
|
|
- assert content['id'] == 12
|
|
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'
|
|
@@ -599,7 +599,7 @@ class TestWorkspaceContents(FunctionalTest):
|
599
|
599
|
assert len(res) == 1
|
600
|
600
|
content = res[0]
|
601
|
601
|
assert content['content_type'] == 'page'
|
602
|
|
- assert content['id'] == 13
|
|
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')
|
|
@@ -636,7 +636,7 @@ class TestWorkspaceContents(FunctionalTest):
|
636
|
636
|
assert len(res) == 1
|
637
|
637
|
content = res[0]
|
638
|
638
|
assert content['content_type'] == 'page'
|
639
|
|
- assert content['id'] == 14
|
|
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')
|
|
@@ -751,7 +751,7 @@ class TestWorkspaceContents(FunctionalTest):
|
751
|
751
|
assert res
|
752
|
752
|
assert res.json_body
|
753
|
753
|
assert res.json_body['status'] == 'open'
|
754
|
|
- assert res.json_body['id']
|
|
754
|
+ assert res.json_body['content_id']
|
755
|
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
|
|
@@ -801,8 +801,8 @@ class TestWorkspaceContents(FunctionalTest):
|
801
|
801
|
}
|
802
|
802
|
folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
803
|
803
|
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
|
|
804
|
+ assert [content for content in folder1_contents if content['content_id'] == 8] # nopep8
|
|
805
|
+ assert not [content for content in folder2_contents if content['content_id'] == 8] # nopep8
|
806
|
806
|
# TODO - G.M - 2018-06-163 - Check content
|
807
|
807
|
res = self.testapp.put_json(
|
808
|
808
|
'/api/v2/workspaces/2/contents/8/move',
|
|
@@ -811,8 +811,8 @@ class TestWorkspaceContents(FunctionalTest):
|
811
|
811
|
)
|
812
|
812
|
new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
813
|
813
|
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
|
|
814
|
+ assert not [content for content in new_folder1_contents if content['content_id'] == 8] # nopep8
|
|
815
|
+ assert [content for content in new_folder2_contents if content['content_id'] == 8] # nopep8
|
816
|
816
|
|
817
|
817
|
def test_api_put_delete_content__ok_200__nominal_case(self):
|
818
|
818
|
"""
|
|
@@ -840,8 +840,8 @@ class TestWorkspaceContents(FunctionalTest):
|
840
|
840
|
}
|
841
|
841
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
842
|
842
|
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
|
|
843
|
+ assert [content for content in active_contents if content['content_id'] == 8] # nopep8
|
|
844
|
+ assert not [content for content in deleted_contents if content['content_id'] == 8] # nopep8
|
845
|
845
|
# TODO - G.M - 2018-06-163 - Check content
|
846
|
846
|
res = self.testapp.put_json(
|
847
|
847
|
# INFO - G.M - 2018-06-163 - delete Apple_Pie
|
|
@@ -850,8 +850,8 @@ class TestWorkspaceContents(FunctionalTest):
|
850
|
850
|
)
|
851
|
851
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
852
|
852
|
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
|
|
853
|
+ assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8
|
|
854
|
+ assert [content for content in new_deleted_contents if content['content_id'] == 8] # nopep8
|
855
|
855
|
|
856
|
856
|
def test_api_put_archive_content__ok_200__nominal_case(self):
|
857
|
857
|
"""
|
|
@@ -879,16 +879,16 @@ class TestWorkspaceContents(FunctionalTest):
|
879
|
879
|
}
|
880
|
880
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
881
|
881
|
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
|
|
882
|
+ assert [content for content in active_contents if content['content_id'] == 8] # nopep8
|
|
883
|
+ assert not [content for content in archived_contents if content['content_id'] == 8] # nopep8
|
884
|
884
|
res = self.testapp.put_json(
|
885
|
885
|
'/api/v2/workspaces/2/contents/8/archive',
|
886
|
886
|
status=200
|
887
|
887
|
)
|
888
|
888
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
889
|
889
|
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
|
|
890
|
+ assert not [content for content in new_active_contents if content['content_id'] == 8] # nopep8
|
|
891
|
+ assert [content for content in new_archived_contents if content['content_id'] == 8] # nopep8
|
892
|
892
|
|
893
|
893
|
def test_api_put_undelete_content__ok_200__nominal_case(self):
|
894
|
894
|
"""
|
|
@@ -916,16 +916,16 @@ class TestWorkspaceContents(FunctionalTest):
|
916
|
916
|
}
|
917
|
917
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
918
|
918
|
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
|
|
919
|
+ assert not [content for content in active_contents if content['content_id'] == 14] # nopep8
|
|
920
|
+ assert [content for content in deleted_contents if content['content_id'] == 14] # nopep8
|
921
|
921
|
res = self.testapp.put_json(
|
922
|
922
|
'/api/v2/workspaces/2/contents/14/undelete',
|
923
|
923
|
status=200
|
924
|
924
|
)
|
925
|
925
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
926
|
926
|
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
|
|
927
|
+ assert [content for content in new_active_contents if content['content_id'] == 14] # nopep8
|
|
928
|
+ assert not [content for content in new_deleted_contents if content['content_id'] == 14] # nopep8
|
929
|
929
|
|
930
|
930
|
def test_api_put_unarchive_content__ok_200__nominal_case(self):
|
931
|
931
|
"""
|
|
@@ -953,13 +953,13 @@ class TestWorkspaceContents(FunctionalTest):
|
953
|
953
|
}
|
954
|
954
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
955
|
955
|
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
|
|
956
|
+ assert not [content for content in active_contents if content['content_id'] == 13] # nopep8
|
|
957
|
+ assert [content for content in archived_contents if content['content_id'] == 13] # nopep8
|
958
|
958
|
res = self.testapp.put_json(
|
959
|
959
|
'/api/v2/workspaces/2/contents/13/unarchive',
|
960
|
960
|
status=200
|
961
|
961
|
)
|
962
|
962
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
963
|
963
|
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
|
|
964
|
+ assert [content for content in new_active_contents if content['content_id'] == 13] # nopep8
|
|
965
|
+ assert not [content for content in new_archived_contents if content['content_id'] == 13] # nopep8
|