Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 3617-3652 (lines=36) @@
3614
        assert [content for content in new_active_contents if content['content_id'] == 14]  # nopep8
3615
        assert not [content for content in new_deleted_contents if content['content_id'] == 14]  # nopep8
3616
3617
    def test_api_put_unarchive_content__ok_200__nominal_case(self):
3618
        """
3619
        unarchive content,
3620
        unarchive Fruit_salads ( content_id: 13, parent_id: 10)
3621
        """
3622
        self.testapp.authorization = (
3623
            'Basic',
3624
            (
3625
                '[email protected]',
3626
                'foobarbaz'
3627
            )
3628
        )
3629
        params_active = {
3630
            'parent_id': 10,
3631
            'show_archived': 0,
3632
            'show_deleted': 0,
3633
            'show_active': 1,
3634
        }
3635
        params_archived = {
3636
            'parent_id': 10,
3637
            'show_archived': 1,
3638
            'show_deleted': 0,
3639
            'show_active': 0,
3640
        }
3641
        active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3642
        archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3643
        assert not [content for content in active_contents if content['content_id'] == 13]  # nopep8
3644
        assert [content for content in archived_contents if content['content_id'] == 13]  # nopep8
3645
        res = self.testapp.put_json(
3646
            '/api/v2/workspaces/2/contents/13/unarchive',
3647
            status=204
3648
        )
3649
        new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3650
        new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3651
        assert [content for content in new_active_contents if content['content_id'] == 13]  # nopep8
3652
        assert not [content for content in new_archived_contents if content['content_id'] == 13]  # nopep8
3653
@@ 3543-3578 (lines=36) @@
3540
        assert not [content for content in new_active_contents if content['content_id'] == 8]  # nopep8
3541
        assert [content for content in new_deleted_contents if content['content_id'] == 8]  # nopep8
3542
3543
    def test_api_put_archive_content__ok_200__nominal_case(self):
3544
        """
3545
        archive content
3546
        archive Apple_pie ( content_id: 8, parent_id: 3)
3547
        """
3548
        self.testapp.authorization = (
3549
            'Basic',
3550
            (
3551
                '[email protected]',
3552
                '[email protected]'
3553
            )
3554
        )
3555
        params_active = {
3556
            'parent_id': 3,
3557
            'show_archived': 0,
3558
            'show_deleted': 0,
3559
            'show_active': 1,
3560
        }
3561
        params_archived = {
3562
            'parent_id': 3,
3563
            'show_archived': 1,
3564
            'show_deleted': 0,
3565
            'show_active': 0,
3566
        }
3567
        active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3568
        archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3569
        assert [content for content in active_contents if content['content_id'] == 8]  # nopep8
3570
        assert not [content for content in archived_contents if content['content_id'] == 8]  # nopep8
3571
        res = self.testapp.put_json(
3572
            '/api/v2/workspaces/2/contents/8/archive',
3573
            status=204
3574
        )
3575
        new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3576
        new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3577
        assert not [content for content in new_active_contents if content['content_id'] == 8]  # nopep8
3578
        assert [content for content in new_archived_contents if content['content_id'] == 8]  # nopep8
3579
3580
    def test_api_put_undelete_content__ok_200__nominal_case(self):
3581
        """