Code Duplication    Length = 62-62 lines in 2 locations

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

@@ 2664-2725 (lines=62) @@
2661
        assert content['workspace_id'] == 1
2662
        assert res[0]['content_id'] != res[1]['content_id']
2663
2664
    def test_api__get_workspace_content__ok_200__get_all_folder_content(self):
2665
        """
2666
         Check obtain workspace folder all contents
2667
         """
2668
        params = {
2669
            'parent_id': 10,  # TODO - G.M - 30-05-2018 - Find a real id
2670
            'show_archived': 1,
2671
            'show_deleted': 1,
2672
            'show_active': 1,
2673
         #   'content_type': 'any'
2674
        }
2675
        self.testapp.authorization = (
2676
            'Basic',
2677
            (
2678
                '[email protected]',
2679
                '[email protected]'
2680
            )
2681
        )
2682
        res = self.testapp.get(
2683
            '/api/v2/workspaces/2/contents',
2684
            status=200,
2685
            params=params,
2686
        ).json_body   # nopep8
2687
        assert len(res) == 3
2688
        content = res[0]
2689
        assert content['content_type'] == 'html-document'
2690
        assert content['content_id'] == 12
2691
        assert content['is_archived'] is False
2692
        assert content['is_deleted'] is False
2693
        assert content['label'] == 'New Fruit Salad'
2694
        assert content['parent_id'] == 10
2695
        assert content['show_in_ui'] is True
2696
        assert content['slug'] == 'new-fruit-salad'
2697
        assert content['status'] == 'open'
2698
        assert set(content['sub_content_types']) == {'comment'}  # nopep8
2699
        assert content['workspace_id'] == 2
2700
2701
        content = res[1]
2702
        assert content['content_type'] == 'html-document'
2703
        assert content['content_id'] == 13
2704
        assert content['is_archived'] is True
2705
        assert content['is_deleted'] is False
2706
        assert content['label'].startswith('Fruit Salad')
2707
        assert content['parent_id'] == 10
2708
        assert content['show_in_ui'] is True
2709
        assert content['slug'].startswith('fruit-salad')
2710
        assert content['status'] == 'open'
2711
        assert set(content['sub_content_types']) == {'comment'}  # nopep8
2712
        assert content['workspace_id'] == 2
2713
2714
        content = res[2]
2715
        assert content['content_type'] == 'html-document'
2716
        assert content['content_id'] == 14
2717
        assert content['is_archived'] is False
2718
        assert content['is_deleted'] is True
2719
        assert content['label'].startswith('Bad Fruit Salad')
2720
        assert content['parent_id'] == 10
2721
        assert content['show_in_ui'] is True
2722
        assert content['slug'].startswith('bad-fruit-salad')
2723
        assert content['status'] == 'open'
2724
        assert set(content['sub_content_types']) == {'comment'}  # nopep8
2725
        assert content['workspace_id'] == 2
2726
2727
    def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self):  # nopep8
2728
        """
@@ 2238-2299 (lines=62) @@
2235
        assert set(content['sub_content_types']) == {'comment'}
2236
        assert content['workspace_id'] == 3
2237
2238
    def test_api__get_workspace_content__ok_200__get_all_root_content(self):
2239
        """
2240
        Check obtain workspace all root contents
2241
        """
2242
        params = {
2243
            'parent_id': 0,
2244
            'show_archived': 1,
2245
            'show_deleted': 1,
2246
            'show_active': 1,
2247
        }
2248
        self.testapp.authorization = (
2249
            'Basic',
2250
            (
2251
                '[email protected]',
2252
                'foobarbaz'
2253
            )
2254
        )
2255
        res = self.testapp.get(
2256
            '/api/v2/workspaces/3/contents',
2257
            status=200,
2258
            params=params,
2259
        ).json_body  # nopep8
2260
        # TODO - G.M - 30-05-2018 - Check this test
2261
        assert len(res) == 4
2262
        content = res[1]
2263
        assert content['content_type'] == 'html-document'
2264
        assert content['content_id'] == 15
2265
        assert content['is_archived'] is False
2266
        assert content['is_deleted'] is False
2267
        assert content['label'] == 'New Fruit Salad'
2268
        assert content['parent_id'] is None
2269
        assert content['show_in_ui'] is True
2270
        assert content['slug'] == 'new-fruit-salad'
2271
        assert content['status'] == 'open'
2272
        assert set(content['sub_content_types']) == {'comment'}
2273
        assert content['workspace_id'] == 3
2274
2275
        content = res[2]
2276
        assert content['content_type'] == 'html-document'
2277
        assert content['content_id'] == 16
2278
        assert content['is_archived'] is True
2279
        assert content['is_deleted'] is False
2280
        assert content['label'].startswith('Fruit Salad')
2281
        assert content['parent_id'] is None
2282
        assert content['show_in_ui'] is True
2283
        assert content['slug'].startswith('fruit-salad')
2284
        assert content['status'] == 'open'
2285
        assert set(content['sub_content_types']) == {'comment'}
2286
        assert content['workspace_id'] == 3
2287
2288
        content = res[3]
2289
        assert content['content_type'] == 'html-document'
2290
        assert content['content_id'] == 17
2291
        assert content['is_archived'] is False
2292
        assert content['is_deleted'] is True
2293
        assert content['label'].startswith('Bad Fruit Salad')
2294
        assert content['parent_id'] is None
2295
        assert content['show_in_ui'] is True
2296
        assert content['slug'].startswith('bad-fruit-salad')
2297
        assert content['status'] == 'open'
2298
        assert set(content['sub_content_types']) == {'comment'}
2299
        assert content['workspace_id'] == 3
2300
2301
    def test_api__get_workspace_content__ok_200__get_only_active_root_content(self):  # nopep8
2302
        """