Browse Source

disable markdownpage and calendar + fix tests related

Guénaël Muller 6 years ago
parent
commit
55422eec68

+ 3 - 2
backend/tracim_backend/models/applications.py View File

102
 # List of applications
102
 # List of applications
103
 applications = [
103
 applications = [
104
     html_documents,
104
     html_documents,
105
-    markdownpluspage,
105
+    # TODO - G.M - 2018-08-02 - Restore markdownpage app
106
+    # markdownpluspage,
106
     _file,
107
     _file,
107
     thread,
108
     thread,
108
     folder,
109
     folder,
109
-    calendar,
110
+    # calendar,
110
 ]
111
 ]

+ 2 - 1
backend/tracim_backend/models/contents.py View File

262
     [
262
     [
263
         thread_type,
263
         thread_type,
264
         file_type,
264
         file_type,
265
-        markdownpluspage_type,
265
+        # TODO - G.M - 2018-08-02 - Restore markdown page content
266
+        #    markdownpluspage_type,
266
         html_documents_type,
267
         html_documents_type,
267
     ]
268
     ]
268
 )
269
 )

+ 15 - 37
backend/tracim_backend/tests/functional/test_system.py View File

1
 # coding=utf-8
1
 # coding=utf-8
2
+from tracim_backend.models.contents import CONTENT_TYPES
2
 from tracim_backend.tests import FunctionalTest
3
 from tracim_backend.tests import FunctionalTest
3
 from tracim_backend.models.applications import applications
4
 from tracim_backend.models.applications import applications
4
 
5
 
70
         )
71
         )
71
         res = self.testapp.get('/api/v2/system/content_types', status=200)
72
         res = self.testapp.get('/api/v2/system/content_types', status=200)
72
         res = res.json_body
73
         res = res.json_body
74
+        assert len(res) == len(CONTENT_TYPES.endpoint_allowed_types_slug())
75
+        content_types = CONTENT_TYPES.endpoint_allowed_types_slug()
73
 
76
 
74
-        content_type = res[1]
75
-        assert content_type['slug'] == 'thread'
76
-        assert content_type['fa_icon'] == 'comments-o'
77
-        assert content_type['hexcolor'] == '#ad4cf9'
78
-        assert content_type['label'] == 'Thread'
79
-        assert content_type['creation_label'] == 'Discuss about a topic'
80
-        assert 'available_statuses' in content_type
81
-        assert len(content_type['available_statuses']) == 4
82
-
83
-        content_type = res[2]
84
-        assert content_type['slug'] == 'file'
85
-        assert content_type['fa_icon'] == 'paperclip'
86
-        assert content_type['hexcolor'] == '#FF9900'
87
-        assert content_type['label'] == 'File'
88
-        assert content_type['creation_label'] == 'Upload a file'
89
-        assert 'available_statuses' in content_type
90
-        assert len(content_type['available_statuses']) == 4
91
-
92
-        content_type = res[3]
93
-        assert content_type['slug'] == 'markdownpage'
94
-        assert content_type['fa_icon'] == 'file-code-o'
95
-        assert content_type['hexcolor'] == '#f12d2d'
96
-        assert content_type['label'] == 'Rich Markdown File'
97
-        assert content_type['creation_label'] == 'Create a Markdown document'
98
-        assert 'available_statuses' in content_type
99
-        assert len(content_type['available_statuses']) == 4
100
-
101
-        content_type = res[4]
102
-        assert content_type['slug'] == 'html-document'
103
-        assert content_type['fa_icon'] == 'file-text-o'
104
-        assert content_type['hexcolor'] == '#3f52e3'
105
-        assert content_type['label'] == 'Text Document'
106
-        assert content_type['creation_label'] == 'Write a document'
107
-        assert 'available_statuses' in content_type
108
-        assert len(content_type['available_statuses']) == 4
109
-        # TODO - G.M - 31-05-2018 - Check Folder type
110
-        # TODO - G.M - 29-05-2018 - Better check for available_statuses
77
+        for counter, content_type_slug in enumerate(content_types):
78
+            content_type = CONTENT_TYPES.get_one_by_slug(content_type_slug)
79
+            assert res[counter]['slug'] == content_type.slug
80
+            assert res[counter]['fa_icon'] == content_type.fa_icon
81
+            assert res[counter]['hexcolor'] == content_type.hexcolor
82
+            assert res[counter]['label'] == content_type.label
83
+            assert res[counter]['creation_label'] == content_type.creation_label
84
+            for status_counter, status in enumerate(content_type.available_statuses):
85
+                assert res[counter]['available_statuses'][status_counter]['fa_icon'] == status.fa_icon  # nopep8
86
+                assert res[counter]['available_statuses'][status_counter]['global_status'] == status.global_status  # nopep8
87
+                assert res[counter]['available_statuses'][status_counter]['slug'] == status.slug  # nopep8
88
+                assert res[counter]['available_statuses'][status_counter]['hexcolor'] == status.hexcolor  # nopep8
111
 
89
 
112
     def test_api__get_content_types__err_401__unregistered_user(self):
90
     def test_api__get_content_types__err_401__unregistered_user(self):
113
         """
91
         """

+ 4 - 15
backend/tracim_backend/tests/functional/test_user.py View File

2382
         assert workspace['workspace_id'] == 1
2382
         assert workspace['workspace_id'] == 1
2383
         assert workspace['label'] == 'Business'
2383
         assert workspace['label'] == 'Business'
2384
         assert workspace['slug'] == 'business'
2384
         assert workspace['slug'] == 'business'
2385
-        assert len(workspace['sidebar_entries']) == 7
2385
+        assert len(workspace['sidebar_entries']) == 5
2386
 
2386
 
2387
+        # TODO - G.M - 2018-08-02 - Better test for sidebar entry, make it
2388
+        # not fixed on active application/content-file
2387
         sidebar_entry = workspace['sidebar_entries'][0]
2389
         sidebar_entry = workspace['sidebar_entries'][0]
2388
         assert sidebar_entry['slug'] == 'dashboard'
2390
         assert sidebar_entry['slug'] == 'dashboard'
2389
         assert sidebar_entry['label'] == 'Dashboard'
2391
         assert sidebar_entry['label'] == 'Dashboard'
2406
         assert sidebar_entry['fa_icon'] == "file-text-o"
2408
         assert sidebar_entry['fa_icon'] == "file-text-o"
2407
 
2409
 
2408
         sidebar_entry = workspace['sidebar_entries'][3]
2410
         sidebar_entry = workspace['sidebar_entries'][3]
2409
-        assert sidebar_entry['slug'] == 'contents/markdownpluspage'
2410
-        assert sidebar_entry['label'] == 'Markdown Plus Documents'
2411
-        assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=markdownpluspage"    # nopep8
2412
-        assert sidebar_entry['hexcolor'] == "#f12d2d"
2413
-        assert sidebar_entry['fa_icon'] == "file-code-o"
2414
-
2415
-        sidebar_entry = workspace['sidebar_entries'][4]
2416
         assert sidebar_entry['slug'] == 'contents/file'
2411
         assert sidebar_entry['slug'] == 'contents/file'
2417
         assert sidebar_entry['label'] == 'Files'
2412
         assert sidebar_entry['label'] == 'Files'
2418
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=file"  # nopep8
2413
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=file"  # nopep8
2419
         assert sidebar_entry['hexcolor'] == "#FF9900"
2414
         assert sidebar_entry['hexcolor'] == "#FF9900"
2420
         assert sidebar_entry['fa_icon'] == "paperclip"
2415
         assert sidebar_entry['fa_icon'] == "paperclip"
2421
 
2416
 
2422
-        sidebar_entry = workspace['sidebar_entries'][5]
2417
+        sidebar_entry = workspace['sidebar_entries'][4]
2423
         assert sidebar_entry['slug'] == 'contents/thread'
2418
         assert sidebar_entry['slug'] == 'contents/thread'
2424
         assert sidebar_entry['label'] == 'Threads'
2419
         assert sidebar_entry['label'] == 'Threads'
2425
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=thread"  # nopep8
2420
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=thread"  # nopep8
2426
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
2421
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
2427
         assert sidebar_entry['fa_icon'] == "comments-o"
2422
         assert sidebar_entry['fa_icon'] == "comments-o"
2428
 
2423
 
2429
-        sidebar_entry = workspace['sidebar_entries'][6]
2430
-        assert sidebar_entry['slug'] == 'calendar'
2431
-        assert sidebar_entry['label'] == 'Calendar'
2432
-        assert sidebar_entry['route'] == "/#/workspaces/1/calendar"  # nopep8
2433
-        assert sidebar_entry['hexcolor'] == "#757575"
2434
-        assert sidebar_entry['fa_icon'] == "calendar"
2435
 
2424
 
2436
     def test_api__get_user_workspaces__err_403__unallowed_user(self):
2425
     def test_api__get_user_workspaces__err_403__unallowed_user(self):
2437
         """
2426
         """

+ 14 - 26
backend/tracim_backend/tests/functional/test_workspaces.py View File

41
         assert workspace['slug'] == 'business'
41
         assert workspace['slug'] == 'business'
42
         assert workspace['label'] == 'Business'
42
         assert workspace['label'] == 'Business'
43
         assert workspace['description'] == 'All importants documents'
43
         assert workspace['description'] == 'All importants documents'
44
-        assert len(workspace['sidebar_entries']) == 7
44
+        assert len(workspace['sidebar_entries']) == 5
45
 
45
 
46
+        # TODO - G.M - 2018-08-02 - Better test for sidebar entry, make it
47
+        # not fixed on active application/content-file
46
         sidebar_entry = workspace['sidebar_entries'][0]
48
         sidebar_entry = workspace['sidebar_entries'][0]
47
         assert sidebar_entry['slug'] == 'dashboard'
49
         assert sidebar_entry['slug'] == 'dashboard'
48
         assert sidebar_entry['label'] == 'Dashboard'
50
         assert sidebar_entry['label'] == 'Dashboard'
65
         assert sidebar_entry['fa_icon'] == "file-text-o"
67
         assert sidebar_entry['fa_icon'] == "file-text-o"
66
 
68
 
67
         sidebar_entry = workspace['sidebar_entries'][3]
69
         sidebar_entry = workspace['sidebar_entries'][3]
68
-        assert sidebar_entry['slug'] == 'contents/markdownpluspage'
69
-        assert sidebar_entry['label'] == 'Markdown Plus Documents'
70
-        assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=markdownpluspage"    # nopep8
71
-        assert sidebar_entry['hexcolor'] == "#f12d2d"
72
-        assert sidebar_entry['fa_icon'] == "file-code-o"
73
-
74
-        sidebar_entry = workspace['sidebar_entries'][4]
75
         assert sidebar_entry['slug'] == 'contents/file'
70
         assert sidebar_entry['slug'] == 'contents/file'
76
         assert sidebar_entry['label'] == 'Files'
71
         assert sidebar_entry['label'] == 'Files'
77
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=file"  # nopep8
72
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=file"  # nopep8
78
         assert sidebar_entry['hexcolor'] == "#FF9900"
73
         assert sidebar_entry['hexcolor'] == "#FF9900"
79
         assert sidebar_entry['fa_icon'] == "paperclip"
74
         assert sidebar_entry['fa_icon'] == "paperclip"
80
 
75
 
81
-        sidebar_entry = workspace['sidebar_entries'][5]
76
+        sidebar_entry = workspace['sidebar_entries'][4]
82
         assert sidebar_entry['slug'] == 'contents/thread'
77
         assert sidebar_entry['slug'] == 'contents/thread'
83
         assert sidebar_entry['label'] == 'Threads'
78
         assert sidebar_entry['label'] == 'Threads'
84
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=thread"  # nopep8
79
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=thread"  # nopep8
85
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
80
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
86
         assert sidebar_entry['fa_icon'] == "comments-o"
81
         assert sidebar_entry['fa_icon'] == "comments-o"
87
 
82
 
88
-        sidebar_entry = workspace['sidebar_entries'][6]
89
-        assert sidebar_entry['slug'] == 'calendar'
90
-        assert sidebar_entry['label'] == 'Calendar'
91
-        assert sidebar_entry['route'] == "/#/workspaces/1/calendar"  # nopep8
92
-        assert sidebar_entry['hexcolor'] == "#757575"
93
-        assert sidebar_entry['fa_icon'] == "calendar"
94
-
95
     def test_api__update_workspace__ok_200__nominal_case(self) -> None:
83
     def test_api__update_workspace__ok_200__nominal_case(self) -> None:
96
         """
84
         """
97
         Test update workspace
85
         Test update workspace
118
         assert workspace['slug'] == 'business'
106
         assert workspace['slug'] == 'business'
119
         assert workspace['label'] == 'Business'
107
         assert workspace['label'] == 'Business'
120
         assert workspace['description'] == 'All importants documents'
108
         assert workspace['description'] == 'All importants documents'
121
-        assert len(workspace['sidebar_entries']) == 7
109
+        assert len(workspace['sidebar_entries']) == 5
122
 
110
 
123
         # modify workspace
111
         # modify workspace
124
         res = self.testapp.put_json(
112
         res = self.testapp.put_json(
132
         assert workspace['slug'] == 'superworkspace'
120
         assert workspace['slug'] == 'superworkspace'
133
         assert workspace['label'] == 'superworkspace'
121
         assert workspace['label'] == 'superworkspace'
134
         assert workspace['description'] == 'mysuperdescription'
122
         assert workspace['description'] == 'mysuperdescription'
135
-        assert len(workspace['sidebar_entries']) == 7
123
+        assert len(workspace['sidebar_entries']) == 5
136
 
124
 
137
         # after
125
         # after
138
         res = self.testapp.get(
126
         res = self.testapp.get(
145
         assert workspace['slug'] == 'superworkspace'
133
         assert workspace['slug'] == 'superworkspace'
146
         assert workspace['label'] == 'superworkspace'
134
         assert workspace['label'] == 'superworkspace'
147
         assert workspace['description'] == 'mysuperdescription'
135
         assert workspace['description'] == 'mysuperdescription'
148
-        assert len(workspace['sidebar_entries']) == 7
136
+        assert len(workspace['sidebar_entries']) == 5
149
 
137
 
150
     def test_api__update_workspace__err_400__empty_label(self) -> None:
138
     def test_api__update_workspace__err_400__empty_label(self) -> None:
151
         """
139
         """
1438
         params = {
1426
         params = {
1439
             'parent_id': None,
1427
             'parent_id': None,
1440
             'label': 'GenericCreatedContent',
1428
             'label': 'GenericCreatedContent',
1441
-            'content_type': 'markdownpage',
1429
+            'content_type': 'html-document',
1442
         }
1430
         }
1443
         res = self.testapp.post_json(
1431
         res = self.testapp.post_json(
1444
             '/api/v2/workspaces/1/contents',
1432
             '/api/v2/workspaces/1/contents',
1449
         assert res.json_body
1437
         assert res.json_body
1450
         assert res.json_body['status'] == 'open'
1438
         assert res.json_body['status'] == 'open'
1451
         assert res.json_body['content_id']
1439
         assert res.json_body['content_id']
1452
-        assert res.json_body['content_type'] == 'markdownpage'
1440
+        assert res.json_body['content_type'] == 'html-document'
1453
         assert res.json_body['is_archived'] is False
1441
         assert res.json_body['is_archived'] is False
1454
         assert res.json_body['is_deleted'] is False
1442
         assert res.json_body['is_deleted'] is False
1455
         assert res.json_body['workspace_id'] == 1
1443
         assert res.json_body['workspace_id'] == 1
1480
         )
1468
         )
1481
         params = {
1469
         params = {
1482
             'label': 'GenericCreatedContent',
1470
             'label': 'GenericCreatedContent',
1483
-            'content_type': 'markdownpage',
1471
+            'content_type': 'html-document',
1484
         }
1472
         }
1485
         res = self.testapp.post_json(
1473
         res = self.testapp.post_json(
1486
             '/api/v2/workspaces/1/contents',
1474
             '/api/v2/workspaces/1/contents',
1491
         assert res.json_body
1479
         assert res.json_body
1492
         assert res.json_body['status'] == 'open'
1480
         assert res.json_body['status'] == 'open'
1493
         assert res.json_body['content_id']
1481
         assert res.json_body['content_id']
1494
-        assert res.json_body['content_type'] == 'markdownpage'
1482
+        assert res.json_body['content_type'] == 'html-document'
1495
         assert res.json_body['is_archived'] is False
1483
         assert res.json_body['is_archived'] is False
1496
         assert res.json_body['is_deleted'] is False
1484
         assert res.json_body['is_deleted'] is False
1497
         assert res.json_body['workspace_id'] == 1
1485
         assert res.json_body['workspace_id'] == 1
1544
         )
1532
         )
1545
         params = {
1533
         params = {
1546
             'label': 'GenericCreatedContent',
1534
             'label': 'GenericCreatedContent',
1547
-            'content_type': 'markdownpage',
1535
+            'content_type': 'html-document',
1548
             'parent_id': 10,
1536
             'parent_id': 10,
1549
         }
1537
         }
1550
         res = self.testapp.post_json(
1538
         res = self.testapp.post_json(
1556
         assert res.json_body
1544
         assert res.json_body
1557
         assert res.json_body['status'] == 'open'
1545
         assert res.json_body['status'] == 'open'
1558
         assert res.json_body['content_id']
1546
         assert res.json_body['content_id']
1559
-        assert res.json_body['content_type'] == 'markdownpage'
1547
+        assert res.json_body['content_type'] == 'html-document'
1560
         assert res.json_body['is_archived'] is False
1548
         assert res.json_body['is_archived'] is False
1561
         assert res.json_body['is_deleted'] is False
1549
         assert res.json_body['is_deleted'] is False
1562
         assert res.json_body['workspace_id'] == 1
1550
         assert res.json_body['workspace_id'] == 1
1587
         )
1575
         )
1588
         params = {
1576
         params = {
1589
             'label': '',
1577
             'label': '',
1590
-            'content_type': 'markdownpage',
1578
+            'content_type': 'html-document',
1591
         }
1579
         }
1592
         res = self.testapp.post_json(
1580
         res = self.testapp.post_json(
1593
             '/api/v2/workspaces/1/contents',
1581
             '/api/v2/workspaces/1/contents',