Browse Source

Add is_deleted field in workspace digest schema

Guénaël Muller 6 years ago
parent
commit
489e7f93dd

+ 7 - 0
backend/tracim_backend/models/context_models.py View File

455
         return slugify(self.workspace.label)
455
         return slugify(self.workspace.label)
456
 
456
 
457
     @property
457
     @property
458
+    def is_deleted(self) -> bool:
459
+        """
460
+        Is the workspace deleted ?
461
+        """
462
+        return self.workspace.is_deleted
463
+
464
+    @property
458
     def sidebar_entries(self) -> typing.List[WorkspaceMenuEntry]:
465
     def sidebar_entries(self) -> typing.List[WorkspaceMenuEntry]:
459
         """
466
         """
460
         get sidebar entries, those depends on activated apps.
467
         get sidebar entries, those depends on activated apps.

+ 1 - 1
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 workspace['is_deleted'] is False
2385
         assert len(workspace['sidebar_entries']) == 5
2386
         assert len(workspace['sidebar_entries']) == 5
2386
 
2387
 
2387
         # TODO - G.M - 2018-08-02 - Better test for sidebar entry, make it
2388
         # TODO - G.M - 2018-08-02 - Better test for sidebar entry, make it
2421
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
2422
         assert sidebar_entry['hexcolor'] == "#ad4cf9"
2422
         assert sidebar_entry['fa_icon'] == "comments-o"
2423
         assert sidebar_entry['fa_icon'] == "comments-o"
2423
 
2424
 
2424
-
2425
     def test_api__get_user_workspaces__err_403__unallowed_user(self):
2425
     def test_api__get_user_workspaces__err_403__unallowed_user(self):
2426
         """
2426
         """
2427
         Check obtain all workspaces reachables for one user
2427
         Check obtain all workspaces reachables for one user

+ 4 - 0
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 workspace['is_deleted'] is False
44
         assert len(workspace['sidebar_entries']) == 5
45
         assert len(workspace['sidebar_entries']) == 5
45
 
46
 
46
         # TODO - G.M - 2018-08-02 - Better test for sidebar entry, make it
47
         # TODO - G.M - 2018-08-02 - Better test for sidebar entry, make it
106
         assert workspace['slug'] == 'business'
107
         assert workspace['slug'] == 'business'
107
         assert workspace['label'] == 'Business'
108
         assert workspace['label'] == 'Business'
108
         assert workspace['description'] == 'All importants documents'
109
         assert workspace['description'] == 'All importants documents'
110
+        assert workspace['is_deleted'] is False
109
         assert len(workspace['sidebar_entries']) == 5
111
         assert len(workspace['sidebar_entries']) == 5
110
 
112
 
111
         # modify workspace
113
         # modify workspace
120
         assert workspace['slug'] == 'superworkspace'
122
         assert workspace['slug'] == 'superworkspace'
121
         assert workspace['label'] == 'superworkspace'
123
         assert workspace['label'] == 'superworkspace'
122
         assert workspace['description'] == 'mysuperdescription'
124
         assert workspace['description'] == 'mysuperdescription'
125
+        assert workspace['is_deleted'] is False
123
         assert len(workspace['sidebar_entries']) == 5
126
         assert len(workspace['sidebar_entries']) == 5
124
 
127
 
125
         # after
128
         # after
133
         assert workspace['slug'] == 'superworkspace'
136
         assert workspace['slug'] == 'superworkspace'
134
         assert workspace['label'] == 'superworkspace'
137
         assert workspace['label'] == 'superworkspace'
135
         assert workspace['description'] == 'mysuperdescription'
138
         assert workspace['description'] == 'mysuperdescription'
139
+        assert workspace['is_deleted'] is False
136
         assert len(workspace['sidebar_entries']) == 5
140
         assert len(workspace['sidebar_entries']) == 5
137
 
141
 
138
     def test_api__update_workspace__err_400__empty_label(self) -> None:
142
     def test_api__update_workspace__err_400__empty_label(self) -> None:

+ 1 - 0
backend/tracim_backend/views/core_api/schemas.py View File

509
         WorkspaceMenuEntrySchema,
509
         WorkspaceMenuEntrySchema,
510
         many=True,
510
         many=True,
511
     )
511
     )
512
+    is_deleted = marshmallow.fields.Bool(example=False, default=False)
512
 
513
 
513
     class Meta:
514
     class Meta:
514
         description = 'Digest of workspace informations'
515
         description = 'Digest of workspace informations'