Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 4336-4371 (lines=36) @@
4333
        assert [content for content in new_active_contents if content['content_id'] == 14]  # nopep8
4334
        assert not [content for content in new_deleted_contents if content['content_id'] == 14]  # nopep8
4335
4336
    def test_api_put_unarchive_content__ok_200__nominal_case(self):
4337
        """
4338
        unarchive content,
4339
        unarchive Fruit_salads ( content_id: 13, parent_id: 10)
4340
        """
4341
        self.testapp.authorization = (
4342
            'Basic',
4343
            (
4344
                '[email protected]',
4345
                'foobarbaz'
4346
            )
4347
        )
4348
        params_active = {
4349
            'parent_id': 10,
4350
            'show_archived': 0,
4351
            'show_deleted': 0,
4352
            'show_active': 1,
4353
        }
4354
        params_archived = {
4355
            'parent_id': 10,
4356
            'show_archived': 1,
4357
            'show_deleted': 0,
4358
            'show_active': 0,
4359
        }
4360
        active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
4361
        archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
4362
        assert not [content for content in active_contents if content['content_id'] == 13]  # nopep8
4363
        assert [content for content in archived_contents if content['content_id'] == 13]  # nopep8
4364
        res = self.testapp.put_json(
4365
            '/api/v2/workspaces/2/contents/13/archived/restore',
4366
            status=204
4367
        )
4368
        new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
4369
        new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
4370
        assert [content for content in new_active_contents if content['content_id'] == 13]  # nopep8
4371
        assert not [content for content in new_archived_contents if content['content_id'] == 13]  # nopep8
4372
@@ 4262-4297 (lines=36) @@
4259
        assert not [content for content in new_active_contents if content['content_id'] == 8]  # nopep8
4260
        assert [content for content in new_deleted_contents if content['content_id'] == 8]  # nopep8
4261
4262
    def test_api_put_archive_content__ok_200__nominal_case(self):
4263
        """
4264
        archive content
4265
        archive Apple_pie ( content_id: 8, parent_id: 3)
4266
        """
4267
        self.testapp.authorization = (
4268
            'Basic',
4269
            (
4270
                '[email protected]',
4271
                '[email protected]'
4272
            )
4273
        )
4274
        params_active = {
4275
            'parent_id': 3,
4276
            'show_archived': 0,
4277
            'show_deleted': 0,
4278
            'show_active': 1,
4279
        }
4280
        params_archived = {
4281
            'parent_id': 3,
4282
            'show_archived': 1,
4283
            'show_deleted': 0,
4284
            'show_active': 0,
4285
        }
4286
        active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
4287
        archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
4288
        assert [content for content in active_contents if content['content_id'] == 8]  # nopep8
4289
        assert not [content for content in archived_contents if content['content_id'] == 8]  # nopep8
4290
        res = self.testapp.put_json(
4291
            '/api/v2/workspaces/2/contents/8/archived',
4292
            status=204
4293
        )
4294
        new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body  # nopep8
4295
        new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body  # nopep8
4296
        assert not [content for content in new_active_contents if content['content_id'] == 8]  # nopep8
4297
        assert [content for content in new_archived_contents if content['content_id'] == 8]  # nopep8
4298
4299
    def test_api_put_undelete_content__ok_200__nominal_case(self):
4300
        """