Code Duplication    Length = 37-39 lines in 5 locations

backend/tracim_backend/tests/functional/test_workspaces.py 5 locations

@@ 3013-3051 (lines=39) @@
3010
        assert content['modified']
3011
        assert content['created']
3012
3013
    def test_api__get_workspace_content__ok_200__get_only_deleted_root_content(self):  # nopep8
3014
        """
3015
         Check obtain workspace root deleted contents
3016
         """
3017
        params = {
3018
            'parent_id': 0,
3019
            'show_archived': 0,
3020
            'show_deleted': 1,
3021
            'show_active': 0,
3022
        }
3023
        self.testapp.authorization = (
3024
            'Basic',
3025
            (
3026
                '[email protected]',
3027
                'foobarbaz'
3028
            )
3029
        )
3030
        res = self.testapp.get(
3031
            '/api/v2/workspaces/3/contents',
3032
            status=200,
3033
            params=params,
3034
        ).json_body   # nopep8
3035
        # TODO - G.M - 30-05-2018 - Check this test
3036
3037
        assert len(res) == 1
3038
        content = res[0]
3039
        assert content['content_type'] == 'html-document'
3040
        assert content['content_id'] == 17
3041
        assert content['is_archived'] is False
3042
        assert content['is_deleted'] is True
3043
        assert content['label'].startswith('Bad Fruit Salad')
3044
        assert content['parent_id'] is None
3045
        assert content['show_in_ui'] is True
3046
        assert content['slug'].startswith('bad-fruit-salad')
3047
        assert content['status'] == 'open'
3048
        assert set(content['sub_content_types']) == {'comment'}
3049
        assert content['workspace_id'] == 3
3050
        assert content['modified']
3051
        assert content['created']
3052
3053
    def test_api__get_workspace_content__ok_200__get_nothing_root_content(self):
3054
        """
@@ 3454-3491 (lines=38) @@
3451
        assert content['modified']
3452
        assert content['created']
3453
3454
    def test_api__get_workspace_content__ok_200__get_only_deleted_folder_content(self):  # nopep8
3455
        """
3456
         Check obtain workspace folder deleted contents
3457
         """
3458
        params = {
3459
            'parent_id': 10,
3460
            'show_archived': 0,
3461
            'show_deleted': 1,
3462
            'show_active': 0,
3463
        }
3464
        self.testapp.authorization = (
3465
            'Basic',
3466
            (
3467
                '[email protected]',
3468
                '[email protected]'
3469
            )
3470
        )
3471
        res = self.testapp.get(
3472
            '/api/v2/workspaces/2/contents',
3473
            status=200,
3474
            params=params,
3475
        ).json_body   # nopep8
3476
3477
        assert len(res) == 1
3478
        content = res[0]
3479
        assert content['content_type'] == 'html-document'
3480
        assert content['content_id'] == 14
3481
        assert content['is_archived'] is False
3482
        assert content['is_deleted'] is True
3483
        assert content['label'].startswith('Bad Fruit Salad')
3484
        assert content['parent_id'] == 10
3485
        assert content['show_in_ui'] is True
3486
        assert content['slug'].startswith('bad-fruit-salad')
3487
        assert content['status'] == 'open'
3488
        assert set(content['sub_content_types']) == {'comment'}  # nopep8
3489
        assert content['workspace_id'] == 2
3490
        assert content['modified']
3491
        assert content['created']
3492
3493
    def test_api__get_workspace_content__ok_200__get_nothing_folder_content(self):  # nopep8
3494
        """
@@ 3416-3452 (lines=37) @@
3413
        assert content['modified']
3414
        assert content['created']
3415
3416
    def test_api__get_workspace_content__ok_200__get_only_archived_folder_content(self):  # nopep8
3417
        """
3418
         Check obtain workspace folder archived contents
3419
         """
3420
        params = {
3421
            'parent_id': 10,
3422
            'show_archived': 1,
3423
            'show_deleted': 0,
3424
            'show_active': 0,
3425
        }
3426
        self.testapp.authorization = (
3427
            'Basic',
3428
            (
3429
                '[email protected]',
3430
                '[email protected]'
3431
            )
3432
        )
3433
        res = self.testapp.get(
3434
            '/api/v2/workspaces/2/contents',
3435
            status=200,
3436
            params=params,
3437
        ).json_body   # nopep8
3438
        assert len(res) == 1
3439
        content = res[0]
3440
        assert content['content_type'] == 'html-document'
3441
        assert content['content_id'] == 13
3442
        assert content['is_archived'] is True
3443
        assert content['is_deleted'] is False
3444
        assert content['label'].startswith('Fruit Salad')
3445
        assert content['parent_id'] == 10
3446
        assert content['show_in_ui'] is True
3447
        assert content['slug'].startswith('fruit-salad')
3448
        assert content['status'] == 'open'
3449
        assert set(content['sub_content_types']) == {'comment'}  # nopep8
3450
        assert content['workspace_id'] == 2
3451
        assert content['modified']
3452
        assert content['created']
3453
3454
    def test_api__get_workspace_content__ok_200__get_only_deleted_folder_content(self):  # nopep8
3455
        """
@@ 3378-3414 (lines=37) @@
3375
        assert content['modified']
3376
        assert content['created']
3377
3378
    def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self):  # nopep8
3379
        """
3380
         Check obtain workspace folder active contents
3381
         """
3382
        params = {
3383
            'parent_id': 10,
3384
            'show_archived': 0,
3385
            'show_deleted': 0,
3386
            'show_active': 1,
3387
        }
3388
        self.testapp.authorization = (
3389
            'Basic',
3390
            (
3391
                '[email protected]',
3392
                '[email protected]'
3393
            )
3394
        )
3395
        res = self.testapp.get(
3396
            '/api/v2/workspaces/2/contents',
3397
            status=200,
3398
            params=params,
3399
        ).json_body   # nopep8
3400
        assert len(res) == 1
3401
        content = res[0]
3402
        assert content['content_type']
3403
        assert content['content_id'] == 12
3404
        assert content['is_archived'] is False
3405
        assert content['is_deleted'] is False
3406
        assert content['label'] == 'New Fruit Salad'
3407
        assert content['parent_id'] == 10
3408
        assert content['show_in_ui'] is True
3409
        assert content['slug'] == 'new-fruit-salad'
3410
        assert content['status'] == 'open'
3411
        assert set(content['sub_content_types']) == {'comment'}  # nopep8
3412
        assert content['workspace_id'] == 2
3413
        assert content['modified']
3414
        assert content['created']
3415
3416
    def test_api__get_workspace_content__ok_200__get_only_archived_folder_content(self):  # nopep8
3417
        """
@@ 2975-3011 (lines=37) @@
2972
        assert content['modified']
2973
        assert content['created']
2974
2975
    def test_api__get_workspace_content__ok_200__get_only_archived_root_content(self):  # nopep8
2976
        """
2977
        Check obtain workspace root archived contents
2978
        """
2979
        params = {
2980
            'parent_id': 0,
2981
            'show_archived': 1,
2982
            'show_deleted': 0,
2983
            'show_active': 0,
2984
        }
2985
        self.testapp.authorization = (
2986
            'Basic',
2987
            (
2988
                '[email protected]',
2989
                'foobarbaz'
2990
            )
2991
        )
2992
        res = self.testapp.get(
2993
            '/api/v2/workspaces/3/contents',
2994
            status=200,
2995
            params=params,
2996
        ).json_body   # nopep8
2997
        assert len(res) == 1
2998
        content = res[0]
2999
        assert content['content_type'] == 'html-document'
3000
        assert content['content_id'] == 16
3001
        assert content['is_archived'] is True
3002
        assert content['is_deleted'] is False
3003
        assert content['label'].startswith('Fruit Salad')
3004
        assert content['parent_id'] is None
3005
        assert content['show_in_ui'] is True
3006
        assert content['slug'].startswith('fruit-salad')
3007
        assert content['status'] == 'open'
3008
        assert set(content['sub_content_types']) == {'comment'}
3009
        assert content['workspace_id'] == 3
3010
        assert content['modified']
3011
        assert content['created']
3012
3013
    def test_api__get_workspace_content__ok_200__get_only_deleted_root_content(self):  # nopep8
3014
        """