|
@@ -219,7 +219,6 @@ class TestWorkspaceMembersEndpoint(FunctionalTest):
|
219
|
219
|
assert 'details' in res.json.keys()
|
220
|
220
|
|
221
|
221
|
|
222
|
|
-@pytest.mark.xfail()
|
223
|
222
|
class TestWorkspaceContents(FunctionalTest):
|
224
|
223
|
"""
|
225
|
224
|
Tests for /api/v2/workspaces/{workspace_id}/contents endpoint
|
|
@@ -240,7 +239,40 @@ class TestWorkspaceContents(FunctionalTest):
|
240
|
239
|
)
|
241
|
240
|
res = self.testapp.get('/api/v2/workspaces/1/contents', status=200).json_body # nopep8
|
242
|
241
|
# TODO - G.M - 30-05-2018 - Check this test
|
243
|
|
- raise NotImplementedError()
|
|
242
|
+ assert len(res) == 3
|
|
243
|
+ content = res[0]
|
|
244
|
+ assert content['id'] == 1
|
|
245
|
+ assert content['is_archived'] is False
|
|
246
|
+ assert content['is_deleted'] is False
|
|
247
|
+ assert content['label'] == 'Tools'
|
|
248
|
+ assert content['parent_id'] is None
|
|
249
|
+ assert content['show_in_ui'] == True
|
|
250
|
+ assert content['slug'] == 'tools'
|
|
251
|
+ assert content['status_slug'] == 'open'
|
|
252
|
+ assert set(content['sub_content_type_slug']) == set(['thread', 'page', 'folder', 'file'])
|
|
253
|
+ assert content['workspace_id'] == 1
|
|
254
|
+ content = res[1]
|
|
255
|
+ assert content['id'] == 2
|
|
256
|
+ assert content['is_archived'] is False
|
|
257
|
+ assert content['is_deleted'] is False
|
|
258
|
+ assert content['label'] == 'Menus'
|
|
259
|
+ assert content['parent_id'] is None
|
|
260
|
+ assert content['show_in_ui'] == True
|
|
261
|
+ assert content['slug'] == 'menus'
|
|
262
|
+ assert content['status_slug'] == 'open'
|
|
263
|
+ assert set(content['sub_content_type_slug']) == set(['thread', 'page', 'folder', 'file'])
|
|
264
|
+ assert content['workspace_id'] == 1
|
|
265
|
+ content = res[2]
|
|
266
|
+ assert content['id'] == 11
|
|
267
|
+ assert content['is_archived'] is False
|
|
268
|
+ assert content['is_deleted'] is False
|
|
269
|
+ assert content['label'] == 'Current Menu'
|
|
270
|
+ assert content['parent_id'] == 2
|
|
271
|
+ assert content['show_in_ui'] == True
|
|
272
|
+ assert content['slug'] == 'current-menu'
|
|
273
|
+ assert content['status_slug'] == 'open'
|
|
274
|
+ assert set(content['sub_content_type_slug']) == set(['thread', 'page', 'folder', 'file'])
|
|
275
|
+ assert content['workspace_id'] == 1
|
244
|
276
|
|
245
|
277
|
# Root related
|
246
|
278
|
|
|
@@ -267,8 +299,31 @@ class TestWorkspaceContents(FunctionalTest):
|
267
|
299
|
params=params,
|
268
|
300
|
).json_body # nopep8
|
269
|
301
|
# TODO - G.M - 30-05-2018 - Check this test
|
270
|
|
- raise NotImplementedError()
|
271
|
|
-
|
|
302
|
+ assert len(res) == 2
|
|
303
|
+ content = res[0]
|
|
304
|
+ assert content['id'] == 1
|
|
305
|
+ assert content['is_archived'] is False
|
|
306
|
+ assert content['is_deleted'] is False
|
|
307
|
+ assert content['label'] == 'Tools'
|
|
308
|
+ assert content['parent_id'] is None
|
|
309
|
+ assert content['show_in_ui'] == True
|
|
310
|
+ assert content['slug'] == 'tools'
|
|
311
|
+ assert content['status_slug'] == 'open'
|
|
312
|
+ assert set(content['sub_content_type_slug']) == set(['thread', 'page', 'folder', 'file'])
|
|
313
|
+ assert content['workspace_id'] == 1
|
|
314
|
+ content = res[1]
|
|
315
|
+ assert content['id'] == 2
|
|
316
|
+ assert content['is_archived'] is False
|
|
317
|
+ assert content['is_deleted'] is False
|
|
318
|
+ assert content['label'] == 'Menus'
|
|
319
|
+ assert content['parent_id'] is None
|
|
320
|
+ assert content['show_in_ui'] == True
|
|
321
|
+ assert content['slug'] == 'menus'
|
|
322
|
+ assert content['status_slug'] == 'open'
|
|
323
|
+ assert set(content['sub_content_type_slug']) == set(['thread', 'page', 'folder', 'file'])
|
|
324
|
+ assert content['workspace_id'] == 1
|
|
325
|
+
|
|
326
|
+ @pytest.mark.xfail()
|
272
|
327
|
def test_api__get_workspace_content__ok_200__get_only_active_root_content(self):
|
273
|
328
|
"""
|
274
|
329
|
Check obtain workspace root active contents
|
|
@@ -294,6 +349,7 @@ class TestWorkspaceContents(FunctionalTest):
|
294
|
349
|
# TODO - G.M - 30-05-2018 - Check this test
|
295
|
350
|
raise NotImplementedError()
|
296
|
351
|
|
|
352
|
+ @pytest.mark.xfail()
|
297
|
353
|
def test_api__get_workspace_content__ok_200__get_only_archived_root_content(self):
|
298
|
354
|
"""
|
299
|
355
|
Check obtain workspace root archived contents
|
|
@@ -319,6 +375,7 @@ class TestWorkspaceContents(FunctionalTest):
|
319
|
375
|
# TODO - G.M - 30-05-2018 - Check this test
|
320
|
376
|
raise NotImplementedError()
|
321
|
377
|
|
|
378
|
+ @pytest.mark.xfail()
|
322
|
379
|
def test_api__get_workspace_content__ok_200__get_only_deleted_root_content(self):
|
323
|
380
|
"""
|
324
|
381
|
Check obtain workspace root deleted contents
|
|
@@ -368,7 +425,7 @@ class TestWorkspaceContents(FunctionalTest):
|
368
|
425
|
params=params,
|
369
|
426
|
).json_body # nopep8
|
370
|
427
|
# TODO - G.M - 30-05-2018 - Check this test
|
371
|
|
- raise NotImplementedError()
|
|
428
|
+ assert res == []
|
372
|
429
|
|
373
|
430
|
# Folder related
|
374
|
431
|
|
|
@@ -395,8 +452,20 @@ class TestWorkspaceContents(FunctionalTest):
|
395
|
452
|
params=params,
|
396
|
453
|
).json_body # nopep8
|
397
|
454
|
# TODO - G.M - 30-05-2018 - Check this test
|
398
|
|
- raise NotImplementedError()
|
399
|
|
-
|
|
455
|
+ assert len(res) == 1
|
|
456
|
+ content = res[0]
|
|
457
|
+ assert content['id'] == 11
|
|
458
|
+ assert content['is_archived'] is False
|
|
459
|
+ assert content['is_deleted'] is False
|
|
460
|
+ assert content['label'] == 'Current Menu'
|
|
461
|
+ assert content['parent_id'] == 2
|
|
462
|
+ assert content['show_in_ui'] == True
|
|
463
|
+ assert content['slug'] == 'current-menu'
|
|
464
|
+ assert content['status_slug'] == 'open'
|
|
465
|
+ assert set(content['sub_content_type_slug']) == set(['thread', 'page', 'folder', 'file'])
|
|
466
|
+ assert content['workspace_id'] == 1
|
|
467
|
+
|
|
468
|
+ @pytest.mark.xfail()
|
400
|
469
|
def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self):
|
401
|
470
|
"""
|
402
|
471
|
Check obtain workspace folder active contents
|
|
@@ -422,6 +491,7 @@ class TestWorkspaceContents(FunctionalTest):
|
422
|
491
|
# TODO - G.M - 30-05-2018 - Check this test
|
423
|
492
|
raise NotImplementedError()
|
424
|
493
|
|
|
494
|
+ @pytest.mark.xfail()
|
425
|
495
|
def test_api__get_workspace_content__ok_200__get_only_archived_folder_content(self):
|
426
|
496
|
"""
|
427
|
497
|
Check obtain workspace folder archived contents
|
|
@@ -447,6 +517,7 @@ class TestWorkspaceContents(FunctionalTest):
|
447
|
517
|
# TODO - G.M - 30-05-2018 - Check this test
|
448
|
518
|
raise NotImplementedError()
|
449
|
519
|
|
|
520
|
+ @pytest.mark.xfail()
|
450
|
521
|
def test_api__get_workspace_content__ok_200__get_only_deleted_folder_content(self):
|
451
|
522
|
"""
|
452
|
523
|
Check obtain workspace folder deleted contents
|
|
@@ -496,7 +567,7 @@ class TestWorkspaceContents(FunctionalTest):
|
496
|
567
|
params=params,
|
497
|
568
|
).json_body # nopep8
|
498
|
569
|
# TODO - G.M - 30-05-2018 - Check this test
|
499
|
|
- raise NotImplementedError()
|
|
570
|
+ assert res == []
|
500
|
571
|
|
501
|
572
|
# Error case
|
502
|
573
|
|
|
@@ -552,7 +623,3 @@ class TestWorkspaceContents(FunctionalTest):
|
552
|
623
|
assert 'code' in res.json.keys()
|
553
|
624
|
assert 'message' in res.json.keys()
|
554
|
625
|
assert 'details' in res.json.keys()
|
555
|
|
-
|
556
|
|
- def test_api_get_workspace_content__err_404__parent_id_does_not_exist(self):
|
557
|
|
- # TODO - G.M - 30-05-2018 - Check this test
|
558
|
|
- raise NotImplementedError()
|