|
|
|
|
27
|
)
|
27
|
)
|
28
|
res = self.testapp.get('/api/v2/workspaces/1', status=200)
|
28
|
res = self.testapp.get('/api/v2/workspaces/1', status=200)
|
29
|
workspace = res.json_body
|
29
|
workspace = res.json_body
|
30
|
- assert workspace['id'] == 1
|
|
|
|
|
30
|
+ assert workspace['workspace_id'] == 1
|
31
|
assert workspace['slug'] == 'business'
|
31
|
assert workspace['slug'] == 'business'
|
32
|
assert workspace['label'] == 'Business'
|
32
|
assert workspace['label'] == 'Business'
|
33
|
assert workspace['description'] == 'All importants documents'
|
33
|
assert workspace['description'] == 'All importants documents'
|
|
|
|
|
239
|
# TODO - G.M - 30-05-2018 - Check this test
|
239
|
# TODO - G.M - 30-05-2018 - Check this test
|
240
|
assert len(res) == 3
|
240
|
assert len(res) == 3
|
241
|
content = res[0]
|
241
|
content = res[0]
|
242
|
- assert content['id'] == 1
|
|
|
|
|
242
|
+ assert content['content_id'] == 1
|
243
|
assert content['is_archived'] is False
|
243
|
assert content['is_archived'] is False
|
244
|
assert content['is_deleted'] is False
|
244
|
assert content['is_deleted'] is False
|
245
|
assert content['label'] == 'Tools'
|
245
|
assert content['label'] == 'Tools'
|
|
|
|
|
250
|
assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
250
|
assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
251
|
assert content['workspace_id'] == 1
|
251
|
assert content['workspace_id'] == 1
|
252
|
content = res[1]
|
252
|
content = res[1]
|
253
|
- assert content['id'] == 2
|
|
|
|
|
253
|
+ assert content['content_id'] == 2
|
254
|
assert content['is_archived'] is False
|
254
|
assert content['is_archived'] is False
|
255
|
assert content['is_deleted'] is False
|
255
|
assert content['is_deleted'] is False
|
256
|
assert content['label'] == 'Menus'
|
256
|
assert content['label'] == 'Menus'
|
|
|
|
|
261
|
assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
261
|
assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'} # nopep8
|
262
|
assert content['workspace_id'] == 1
|
262
|
assert content['workspace_id'] == 1
|
263
|
content = res[2]
|
263
|
content = res[2]
|
264
|
- assert content['id'] == 11
|
|
|
|
|
264
|
+ assert content['content_id'] == 11
|
265
|
assert content['is_archived'] is False
|
265
|
assert content['is_archived'] is False
|
266
|
assert content['is_deleted'] is False
|
266
|
assert content['is_deleted'] is False
|
267
|
assert content['label'] == 'Current Menu'
|
267
|
assert content['label'] == 'Current Menu'
|
|
|
|
|
300
|
assert len(res) == 4
|
300
|
assert len(res) == 4
|
301
|
content = res[1]
|
301
|
content = res[1]
|
302
|
assert content['content_type'] == 'page'
|
302
|
assert content['content_type'] == 'page'
|
303
|
- assert content['id'] == 15
|
|
|
|
|
303
|
+ assert content['content_id'] == 15
|
304
|
assert content['is_archived'] is False
|
304
|
assert content['is_archived'] is False
|
305
|
assert content['is_deleted'] is False
|
305
|
assert content['is_deleted'] is False
|
306
|
assert content['label'] == 'New Fruit Salad'
|
306
|
assert content['label'] == 'New Fruit Salad'
|
|
|
|
|
313
|
|
313
|
|
314
|
content = res[2]
|
314
|
content = res[2]
|
315
|
assert content['content_type'] == 'page'
|
315
|
assert content['content_type'] == 'page'
|
316
|
- assert content['id'] == 16
|
|
|
|
|
316
|
+ assert content['content_id'] == 16
|
317
|
assert content['is_archived'] is True
|
317
|
assert content['is_archived'] is True
|
318
|
assert content['is_deleted'] is False
|
318
|
assert content['is_deleted'] is False
|
319
|
assert content['label'].startswith('Fruit Salad')
|
319
|
assert content['label'].startswith('Fruit Salad')
|
|
|
|
|
326
|
|
326
|
|
327
|
content = res[3]
|
327
|
content = res[3]
|
328
|
assert content['content_type'] == 'page'
|
328
|
assert content['content_type'] == 'page'
|
329
|
- assert content['id'] == 17
|
|
|
|
|
329
|
+ assert content['content_id'] == 17
|
330
|
assert content['is_archived'] is False
|
330
|
assert content['is_archived'] is False
|
331
|
assert content['is_deleted'] is True
|
331
|
assert content['is_deleted'] is True
|
332
|
assert content['label'].startswith('Bad Fruit Salad')
|
332
|
assert content['label'].startswith('Bad Fruit Salad')
|
|
|
|
|
363
|
assert len(res) == 2
|
363
|
assert len(res) == 2
|
364
|
content = res[1]
|
364
|
content = res[1]
|
365
|
assert content['content_type'] == 'page'
|
365
|
assert content['content_type'] == 'page'
|
366
|
- assert content['id'] == 15
|
|
|
|
|
366
|
+ assert content['content_id'] == 15
|
367
|
assert content['is_archived'] is False
|
367
|
assert content['is_archived'] is False
|
368
|
assert content['is_deleted'] is False
|
368
|
assert content['is_deleted'] is False
|
369
|
assert content['label'] == 'New Fruit Salad'
|
369
|
assert content['label'] == 'New Fruit Salad'
|
|
|
|
|
399
|
assert len(res) == 1
|
399
|
assert len(res) == 1
|
400
|
content = res[0]
|
400
|
content = res[0]
|
401
|
assert content['content_type'] == 'page'
|
401
|
assert content['content_type'] == 'page'
|
402
|
- assert content['id'] == 16
|
|
|
|
|
402
|
+ assert content['content_id'] == 16
|
403
|
assert content['is_archived'] is True
|
403
|
assert content['is_archived'] is True
|
404
|
assert content['is_deleted'] is False
|
404
|
assert content['is_deleted'] is False
|
405
|
assert content['label'].startswith('Fruit Salad')
|
405
|
assert content['label'].startswith('Fruit Salad')
|
|
|
|
|
437
|
assert len(res) == 1
|
437
|
assert len(res) == 1
|
438
|
content = res[0]
|
438
|
content = res[0]
|
439
|
assert content['content_type'] == 'page'
|
439
|
assert content['content_type'] == 'page'
|
440
|
- assert content['id'] == 17
|
|
|
|
|
440
|
+ assert content['content_id'] == 17
|
441
|
assert content['is_archived'] is False
|
441
|
assert content['is_archived'] is False
|
442
|
assert content['is_deleted'] is True
|
442
|
assert content['is_deleted'] is True
|
443
|
assert content['label'].startswith('Bad Fruit Salad')
|
443
|
assert content['label'].startswith('Bad Fruit Salad')
|
|
|
|
|
501
|
assert len(res) == 3
|
501
|
assert len(res) == 3
|
502
|
content = res[0]
|
502
|
content = res[0]
|
503
|
assert content['content_type'] == 'page'
|
503
|
assert content['content_type'] == 'page'
|
504
|
- assert content['id'] == 12
|
|
|
|
|
504
|
+ assert content['content_id'] == 12
|
505
|
assert content['is_archived'] is False
|
505
|
assert content['is_archived'] is False
|
506
|
assert content['is_deleted'] is False
|
506
|
assert content['is_deleted'] is False
|
507
|
assert content['label'] == 'New Fruit Salad'
|
507
|
assert content['label'] == 'New Fruit Salad'
|
|
|
|
|
514
|
|
514
|
|
515
|
content = res[1]
|
515
|
content = res[1]
|
516
|
assert content['content_type'] == 'page'
|
516
|
assert content['content_type'] == 'page'
|
517
|
- assert content['id'] == 13
|
|
|
|
|
517
|
+ assert content['content_id'] == 13
|
518
|
assert content['is_archived'] is True
|
518
|
assert content['is_archived'] is True
|
519
|
assert content['is_deleted'] is False
|
519
|
assert content['is_deleted'] is False
|
520
|
assert content['label'].startswith('Fruit Salad')
|
520
|
assert content['label'].startswith('Fruit Salad')
|
|
|
|
|
527
|
|
527
|
|
528
|
content = res[2]
|
528
|
content = res[2]
|
529
|
assert content['content_type'] == 'page'
|
529
|
assert content['content_type'] == 'page'
|
530
|
- assert content['id'] == 14
|
|
|
|
|
530
|
+ assert content['content_id'] == 14
|
531
|
assert content['is_archived'] is False
|
531
|
assert content['is_archived'] is False
|
532
|
assert content['is_deleted'] is True
|
532
|
assert content['is_deleted'] is True
|
533
|
assert content['label'].startswith('Bad Fruit Salad')
|
533
|
assert content['label'].startswith('Bad Fruit Salad')
|
|
|
|
|
563
|
assert len(res) == 1
|
563
|
assert len(res) == 1
|
564
|
content = res[0]
|
564
|
content = res[0]
|
565
|
assert content['content_type']
|
565
|
assert content['content_type']
|
566
|
- assert content['id'] == 12
|
|
|
|
|
566
|
+ assert content['content_id'] == 12
|
567
|
assert content['is_archived'] is False
|
567
|
assert content['is_archived'] is False
|
568
|
assert content['is_deleted'] is False
|
568
|
assert content['is_deleted'] is False
|
569
|
assert content['label'] == 'New Fruit Salad'
|
569
|
assert content['label'] == 'New Fruit Salad'
|
|
|
|
|
599
|
assert len(res) == 1
|
599
|
assert len(res) == 1
|
600
|
content = res[0]
|
600
|
content = res[0]
|
601
|
assert content['content_type'] == 'page'
|
601
|
assert content['content_type'] == 'page'
|
602
|
- assert content['id'] == 13
|
|
|
|
|
602
|
+ assert content['content_id'] == 13
|
603
|
assert content['is_archived'] is True
|
603
|
assert content['is_archived'] is True
|
604
|
assert content['is_deleted'] is False
|
604
|
assert content['is_deleted'] is False
|
605
|
assert content['label'].startswith('Fruit Salad')
|
605
|
assert content['label'].startswith('Fruit Salad')
|
|
|
|
|
636
|
assert len(res) == 1
|
636
|
assert len(res) == 1
|
637
|
content = res[0]
|
637
|
content = res[0]
|
638
|
assert content['content_type'] == 'page'
|
638
|
assert content['content_type'] == 'page'
|
639
|
- assert content['id'] == 14
|
|
|
|
|
639
|
+ assert content['content_id'] == 14
|
640
|
assert content['is_archived'] is False
|
640
|
assert content['is_archived'] is False
|
641
|
assert content['is_deleted'] is True
|
641
|
assert content['is_deleted'] is True
|
642
|
assert content['label'].startswith('Bad Fruit Salad')
|
642
|
assert content['label'].startswith('Bad Fruit Salad')
|
|
|
|
|
751
|
assert res
|
751
|
assert res
|
752
|
assert res.json_body
|
752
|
assert res.json_body
|
753
|
assert res.json_body['status'] == 'open'
|
753
|
assert res.json_body['status'] == 'open'
|
754
|
- assert res.json_body['id']
|
|
|
|
|
754
|
+ assert res.json_body['content_id']
|
755
|
assert res.json_body['content_type'] == 'markdownpage'
|
755
|
assert res.json_body['content_type'] == 'markdownpage'
|
756
|
assert res.json_body['is_archived'] is False
|
756
|
assert res.json_body['is_archived'] is False
|
757
|
assert res.json_body['is_deleted'] is False
|
757
|
assert res.json_body['is_deleted'] is False
|
|
|
|
|
801
|
}
|
801
|
}
|
802
|
folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
802
|
folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
803
|
folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
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
|
# TODO - G.M - 2018-06-163 - Check content
|
806
|
# TODO - G.M - 2018-06-163 - Check content
|
807
|
res = self.testapp.put_json(
|
807
|
res = self.testapp.put_json(
|
808
|
'/api/v2/workspaces/2/contents/8/move',
|
808
|
'/api/v2/workspaces/2/contents/8/move',
|
|
|
|
|
811
|
)
|
811
|
)
|
812
|
new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
812
|
new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
|
813
|
new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
|
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
|
def test_api_put_delete_content__ok_200__nominal_case(self):
|
817
|
def test_api_put_delete_content__ok_200__nominal_case(self):
|
818
|
"""
|
818
|
"""
|
|
|
|
|
840
|
}
|
840
|
}
|
841
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
841
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
842
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
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
|
# TODO - G.M - 2018-06-163 - Check content
|
845
|
# TODO - G.M - 2018-06-163 - Check content
|
846
|
res = self.testapp.put_json(
|
846
|
res = self.testapp.put_json(
|
847
|
# INFO - G.M - 2018-06-163 - delete Apple_Pie
|
847
|
# INFO - G.M - 2018-06-163 - delete Apple_Pie
|
|
|
|
|
850
|
)
|
850
|
)
|
851
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
851
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
852
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
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
|
def test_api_put_archive_content__ok_200__nominal_case(self):
|
856
|
def test_api_put_archive_content__ok_200__nominal_case(self):
|
857
|
"""
|
857
|
"""
|
|
|
|
|
879
|
}
|
879
|
}
|
880
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
880
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
881
|
archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
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
|
res = self.testapp.put_json(
|
884
|
res = self.testapp.put_json(
|
885
|
'/api/v2/workspaces/2/contents/8/archive',
|
885
|
'/api/v2/workspaces/2/contents/8/archive',
|
886
|
status=200
|
886
|
status=200
|
887
|
)
|
887
|
)
|
888
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
888
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
889
|
new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
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
|
def test_api_put_undelete_content__ok_200__nominal_case(self):
|
893
|
def test_api_put_undelete_content__ok_200__nominal_case(self):
|
894
|
"""
|
894
|
"""
|
|
|
|
|
916
|
}
|
916
|
}
|
917
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
917
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
918
|
deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
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
|
res = self.testapp.put_json(
|
921
|
res = self.testapp.put_json(
|
922
|
'/api/v2/workspaces/2/contents/14/undelete',
|
922
|
'/api/v2/workspaces/2/contents/14/undelete',
|
923
|
status=200
|
923
|
status=200
|
924
|
)
|
924
|
)
|
925
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
925
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
926
|
new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
|
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
|
def test_api_put_unarchive_content__ok_200__nominal_case(self):
|
930
|
def test_api_put_unarchive_content__ok_200__nominal_case(self):
|
931
|
"""
|
931
|
"""
|
|
|
|
|
953
|
}
|
953
|
}
|
954
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
954
|
active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
955
|
archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
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
|
res = self.testapp.put_json(
|
958
|
res = self.testapp.put_json(
|
959
|
'/api/v2/workspaces/2/contents/13/unarchive',
|
959
|
'/api/v2/workspaces/2/contents/13/unarchive',
|
960
|
status=200
|
960
|
status=200
|
961
|
)
|
961
|
)
|
962
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
962
|
new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
|
963
|
new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
|
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
|