Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 3128-3163 (lines=36) @@
3125
        assert [content for content in new_active_contents if content['content_id'] == 14]  # nopep8
3126
        assert not [content for content in new_deleted_contents if content['content_id'] == 14]  # nopep8
3127
3128
    def test_api_put_unarchive_content__ok_200__nominal_case(self):
3129
        """
3130
        unarchive content,
3131
        unarchive Fruit_salads ( content_id: 13, parent_id: 10)
3132
        """
3133
        self.testapp.authorization = (
3134
            'Basic',
3135
            (
3136
                '[email protected]',
3137
                'foobarbaz'
3138
            )
3139
        )
3140
        params_active = {
3141
            'parent_id': 10,
3142
            'show_archived': 0,
3143
            'show_deleted': 0,
3144
            'show_active': 1,
3145
        }
3146
        params_archived = {
3147
            'parent_id': 10,
3148
            'show_archived': 1,
3149
            'show_deleted': 0,
3150
            'show_active': 0,
3151
        }
3152
        active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3153
        archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3154
        assert not [content for content in active_contents if content['content_id'] == 13]  # nopep8
3155
        assert [content for content in archived_contents if content['content_id'] == 13]  # nopep8
3156
        res = self.testapp.put_json(
3157
            '/api/v2/workspaces/2/contents/13/unarchive',
3158
            status=204
3159
        )
3160
        new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3161
        new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3162
        assert [content for content in new_active_contents if content['content_id'] == 13]  # nopep8
3163
        assert not [content for content in new_archived_contents if content['content_id'] == 13]  # nopep8
3164
@@ 3054-3089 (lines=36) @@
3051
        assert not [content for content in new_active_contents if content['content_id'] == 8]  # nopep8
3052
        assert [content for content in new_deleted_contents if content['content_id'] == 8]  # nopep8
3053
3054
    def test_api_put_archive_content__ok_200__nominal_case(self):
3055
        """
3056
        archive content
3057
        archive Apple_pie ( content_id: 8, parent_id: 3)
3058
        """
3059
        self.testapp.authorization = (
3060
            'Basic',
3061
            (
3062
                '[email protected]',
3063
                '[email protected]'
3064
            )
3065
        )
3066
        params_active = {
3067
            'parent_id': 3,
3068
            'show_archived': 0,
3069
            'show_deleted': 0,
3070
            'show_active': 1,
3071
        }
3072
        params_archived = {
3073
            'parent_id': 3,
3074
            'show_archived': 1,
3075
            'show_deleted': 0,
3076
            'show_active': 0,
3077
        }
3078
        active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3079
        archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3080
        assert [content for content in active_contents if content['content_id'] == 8]  # nopep8
3081
        assert not [content for content in archived_contents if content['content_id'] == 8]  # nopep8
3082
        res = self.testapp.put_json(
3083
            '/api/v2/workspaces/2/contents/8/archive',
3084
            status=204
3085
        )
3086
        new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
3087
        new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
3088
        assert not [content for content in new_active_contents if content['content_id'] == 8]  # nopep8
3089
        assert [content for content in new_archived_contents if content['content_id'] == 8]  # nopep8
3090
3091
    def test_api_put_undelete_content__ok_200__nominal_case(self):
3092
        """