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,9 +102,10 @@ html_documents = Application(
102 102
 # List of applications
103 103
 applications = [
104 104
     html_documents,
105
-    markdownpluspage,
105
+    # TODO - G.M - 2018-08-02 - Restore markdownpage app
106
+    # markdownpluspage,
106 107
     _file,
107 108
     thread,
108 109
     folder,
109
-    calendar,
110
+    # calendar,
110 111
 ]

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

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

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

@@ -1,4 +1,5 @@
1 1
 # coding=utf-8
2
+from tracim_backend.models.contents import CONTENT_TYPES
2 3
 from tracim_backend.tests import FunctionalTest
3 4
 from tracim_backend.models.applications import applications
4 5
 
@@ -70,44 +71,21 @@ class TestContentsTypesEndpoint(FunctionalTest):
70 71
         )
71 72
         res = self.testapp.get('/api/v2/system/content_types', status=200)
72 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 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,8 +2382,10 @@ class TestUserWorkspaceEndpoint(FunctionalTest):
2382 2382
         assert workspace['workspace_id'] == 1
2383 2383
         assert workspace['label'] == 'Business'
2384 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 2389
         sidebar_entry = workspace['sidebar_entries'][0]
2388 2390
         assert sidebar_entry['slug'] == 'dashboard'
2389 2391
         assert sidebar_entry['label'] == 'Dashboard'
@@ -2406,32 +2408,19 @@ class TestUserWorkspaceEndpoint(FunctionalTest):
2406 2408
         assert sidebar_entry['fa_icon'] == "file-text-o"
2407 2409
 
2408 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 2411
         assert sidebar_entry['slug'] == 'contents/file'
2417 2412
         assert sidebar_entry['label'] == 'Files'
2418 2413
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=file"  # nopep8
2419 2414
         assert sidebar_entry['hexcolor'] == "#FF9900"
2420 2415
         assert sidebar_entry['fa_icon'] == "paperclip"
2421 2416
 
2422
-        sidebar_entry = workspace['sidebar_entries'][5]
2417
+        sidebar_entry = workspace['sidebar_entries'][4]
2423 2418
         assert sidebar_entry['slug'] == 'contents/thread'
2424 2419
         assert sidebar_entry['label'] == 'Threads'
2425 2420
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=thread"  # nopep8
2426 2421
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
2427 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 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,8 +41,10 @@ class TestWorkspaceEndpoint(FunctionalTest):
41 41
         assert workspace['slug'] == 'business'
42 42
         assert workspace['label'] == 'Business'
43 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 48
         sidebar_entry = workspace['sidebar_entries'][0]
47 49
         assert sidebar_entry['slug'] == 'dashboard'
48 50
         assert sidebar_entry['label'] == 'Dashboard'
@@ -65,33 +67,19 @@ class TestWorkspaceEndpoint(FunctionalTest):
65 67
         assert sidebar_entry['fa_icon'] == "file-text-o"
66 68
 
67 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 70
         assert sidebar_entry['slug'] == 'contents/file'
76 71
         assert sidebar_entry['label'] == 'Files'
77 72
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=file"  # nopep8
78 73
         assert sidebar_entry['hexcolor'] == "#FF9900"
79 74
         assert sidebar_entry['fa_icon'] == "paperclip"
80 75
 
81
-        sidebar_entry = workspace['sidebar_entries'][5]
76
+        sidebar_entry = workspace['sidebar_entries'][4]
82 77
         assert sidebar_entry['slug'] == 'contents/thread'
83 78
         assert sidebar_entry['label'] == 'Threads'
84 79
         assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=thread"  # nopep8
85 80
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
86 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 83
     def test_api__update_workspace__ok_200__nominal_case(self) -> None:
96 84
         """
97 85
         Test update workspace
@@ -118,7 +106,7 @@ class TestWorkspaceEndpoint(FunctionalTest):
118 106
         assert workspace['slug'] == 'business'
119 107
         assert workspace['label'] == 'Business'
120 108
         assert workspace['description'] == 'All importants documents'
121
-        assert len(workspace['sidebar_entries']) == 7
109
+        assert len(workspace['sidebar_entries']) == 5
122 110
 
123 111
         # modify workspace
124 112
         res = self.testapp.put_json(
@@ -132,7 +120,7 @@ class TestWorkspaceEndpoint(FunctionalTest):
132 120
         assert workspace['slug'] == 'superworkspace'
133 121
         assert workspace['label'] == 'superworkspace'
134 122
         assert workspace['description'] == 'mysuperdescription'
135
-        assert len(workspace['sidebar_entries']) == 7
123
+        assert len(workspace['sidebar_entries']) == 5
136 124
 
137 125
         # after
138 126
         res = self.testapp.get(
@@ -145,7 +133,7 @@ class TestWorkspaceEndpoint(FunctionalTest):
145 133
         assert workspace['slug'] == 'superworkspace'
146 134
         assert workspace['label'] == 'superworkspace'
147 135
         assert workspace['description'] == 'mysuperdescription'
148
-        assert len(workspace['sidebar_entries']) == 7
136
+        assert len(workspace['sidebar_entries']) == 5
149 137
 
150 138
     def test_api__update_workspace__err_400__empty_label(self) -> None:
151 139
         """
@@ -1438,7 +1426,7 @@ class TestWorkspaceContents(FunctionalTest):
1438 1426
         params = {
1439 1427
             'parent_id': None,
1440 1428
             'label': 'GenericCreatedContent',
1441
-            'content_type': 'markdownpage',
1429
+            'content_type': 'html-document',
1442 1430
         }
1443 1431
         res = self.testapp.post_json(
1444 1432
             '/api/v2/workspaces/1/contents',
@@ -1449,7 +1437,7 @@ class TestWorkspaceContents(FunctionalTest):
1449 1437
         assert res.json_body
1450 1438
         assert res.json_body['status'] == 'open'
1451 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 1441
         assert res.json_body['is_archived'] is False
1454 1442
         assert res.json_body['is_deleted'] is False
1455 1443
         assert res.json_body['workspace_id'] == 1
@@ -1480,7 +1468,7 @@ class TestWorkspaceContents(FunctionalTest):
1480 1468
         )
1481 1469
         params = {
1482 1470
             'label': 'GenericCreatedContent',
1483
-            'content_type': 'markdownpage',
1471
+            'content_type': 'html-document',
1484 1472
         }
1485 1473
         res = self.testapp.post_json(
1486 1474
             '/api/v2/workspaces/1/contents',
@@ -1491,7 +1479,7 @@ class TestWorkspaceContents(FunctionalTest):
1491 1479
         assert res.json_body
1492 1480
         assert res.json_body['status'] == 'open'
1493 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 1483
         assert res.json_body['is_archived'] is False
1496 1484
         assert res.json_body['is_deleted'] is False
1497 1485
         assert res.json_body['workspace_id'] == 1
@@ -1544,7 +1532,7 @@ class TestWorkspaceContents(FunctionalTest):
1544 1532
         )
1545 1533
         params = {
1546 1534
             'label': 'GenericCreatedContent',
1547
-            'content_type': 'markdownpage',
1535
+            'content_type': 'html-document',
1548 1536
             'parent_id': 10,
1549 1537
         }
1550 1538
         res = self.testapp.post_json(
@@ -1556,7 +1544,7 @@ class TestWorkspaceContents(FunctionalTest):
1556 1544
         assert res.json_body
1557 1545
         assert res.json_body['status'] == 'open'
1558 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 1548
         assert res.json_body['is_archived'] is False
1561 1549
         assert res.json_body['is_deleted'] is False
1562 1550
         assert res.json_body['workspace_id'] == 1
@@ -1587,7 +1575,7 @@ class TestWorkspaceContents(FunctionalTest):
1587 1575
         )
1588 1576
         params = {
1589 1577
             'label': '',
1590
-            'content_type': 'markdownpage',
1578
+            'content_type': 'html-document',
1591 1579
         }
1592 1580
         res = self.testapp.post_json(
1593 1581
             '/api/v2/workspaces/1/contents',