|
@@ -3,6 +3,7 @@
|
3
|
3
|
Tests for /api/v2/workspaces subpath endpoints.
|
4
|
4
|
"""
|
5
|
5
|
from tracim.tests import FunctionalTest
|
|
6
|
+from tracim.tests import set_html_document_slug_to_legacy
|
6
|
7
|
from tracim.fixtures.content import Content as ContentFixtures
|
7
|
8
|
from tracim.fixtures.users_and_groups import Base as BaseFixture
|
8
|
9
|
|
|
@@ -273,6 +274,69 @@ class TestWorkspaceContents(FunctionalTest):
|
273
|
274
|
assert content['workspace_id'] == 1
|
274
|
275
|
|
275
|
276
|
# Root related
|
|
277
|
+ def test_api__get_workspace_content__ok_200__get_all_root_content__legacy_html_slug(self):
|
|
278
|
+ """
|
|
279
|
+ Check obtain workspace all root contents
|
|
280
|
+ """
|
|
281
|
+ set_html_document_slug_to_legacy(self.session_factory)
|
|
282
|
+ params = {
|
|
283
|
+ 'parent_id': 0,
|
|
284
|
+ 'show_archived': 1,
|
|
285
|
+ 'show_deleted': 1,
|
|
286
|
+ 'show_active': 1,
|
|
287
|
+ }
|
|
288
|
+ self.testapp.authorization = (
|
|
289
|
+ 'Basic',
|
|
290
|
+ (
|
|
291
|
+ 'bob@fsf.local',
|
|
292
|
+ 'foobarbaz'
|
|
293
|
+ )
|
|
294
|
+ )
|
|
295
|
+ res = self.testapp.get(
|
|
296
|
+ '/api/v2/workspaces/3/contents',
|
|
297
|
+ status=200,
|
|
298
|
+ params=params,
|
|
299
|
+ ).json_body # nopep8
|
|
300
|
+ # TODO - G.M - 30-05-2018 - Check this test
|
|
301
|
+ assert len(res) == 4
|
|
302
|
+ content = res[1]
|
|
303
|
+ assert content['content_type'] == 'html-documents'
|
|
304
|
+ assert content['content_id'] == 15
|
|
305
|
+ assert content['is_archived'] is False
|
|
306
|
+ assert content['is_deleted'] is False
|
|
307
|
+ assert content['label'] == 'New Fruit Salad'
|
|
308
|
+ assert content['parent_id'] is None
|
|
309
|
+ assert content['show_in_ui'] is True
|
|
310
|
+ assert content['slug'] == 'new-fruit-salad'
|
|
311
|
+ assert content['status'] == 'open'
|
|
312
|
+ assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'} # nopep8
|
|
313
|
+ assert content['workspace_id'] == 3
|
|
314
|
+
|
|
315
|
+ content = res[2]
|
|
316
|
+ assert content['content_type'] == 'html-documents'
|
|
317
|
+ assert content['content_id'] == 16
|
|
318
|
+ assert content['is_archived'] is True
|
|
319
|
+ assert content['is_deleted'] is False
|
|
320
|
+ assert content['label'].startswith('Fruit Salad')
|
|
321
|
+ assert content['parent_id'] is None
|
|
322
|
+ assert content['show_in_ui'] is True
|
|
323
|
+ assert content['slug'].startswith('fruit-salad')
|
|
324
|
+ assert content['status'] == 'open'
|
|
325
|
+ assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'} # nopep8
|
|
326
|
+ assert content['workspace_id'] == 3
|
|
327
|
+
|
|
328
|
+ content = res[3]
|
|
329
|
+ assert content['content_type'] == 'html-documents'
|
|
330
|
+ assert content['content_id'] == 17
|
|
331
|
+ assert content['is_archived'] is False
|
|
332
|
+ assert content['is_deleted'] is True
|
|
333
|
+ assert content['label'].startswith('Bad Fruit Salad')
|
|
334
|
+ assert content['parent_id'] is None
|
|
335
|
+ assert content['show_in_ui'] is True
|
|
336
|
+ assert content['slug'].startswith('bad-fruit-salad')
|
|
337
|
+ assert content['status'] == 'open'
|
|
338
|
+ assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'} # nopep8
|
|
339
|
+ assert content['workspace_id'] == 3
|
276
|
340
|
|
277
|
341
|
def test_api__get_workspace_content__ok_200__get_all_root_content(self):
|
278
|
342
|
"""
|