Code Duplication    Length = 41-41 lines in 2 locations

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

@@ 2881-2921 (lines=41) @@
2878
        revision = revisions[4]
2879
        revision['revision_type'] == 'undeletion'
2880
2881
    def test_api__set_thread_status__ok_200__nominal_case(self) -> None:
2882
        """
2883
        Set thread status
2884
        """
2885
        self.testapp.authorization = (
2886
            'Basic',
2887
            (
2888
                '[email protected]',
2889
                '[email protected]'
2890
            )
2891
        )
2892
        params = {
2893
            'status': 'closed-deprecated',
2894
        }
2895
2896
        # before
2897
        res = self.testapp.get(
2898
            '/api/v2/workspaces/2/threads/7',
2899
            status=200
2900
        )   # nopep8
2901
        content = res.json_body
2902
        assert content['content_type'] == 'thread'
2903
        assert content['content_id'] == 7
2904
        assert content['status'] == 'open'
2905
2906
        # set status
2907
        self.testapp.put_json(
2908
            '/api/v2/workspaces/2/threads/7/status',
2909
            params=params,
2910
            status=204
2911
        )
2912
2913
        # after
2914
        res = self.testapp.get(
2915
            '/api/v2/workspaces/2/threads/7',
2916
            status=200
2917
        )   # nopep8
2918
        content = res.json_body
2919
        assert content['content_type'] == 'thread'
2920
        assert content['content_id'] == 7
2921
        assert content['status'] == 'closed-deprecated'
2922
2923
    def test_api__set_thread_status__ok_400__wrong_status(self) -> None:
2924
        """
@@ 1201-1241 (lines=41) @@
1198
        assert revision['author']['avatar_url'] is None
1199
        assert revision['author']['public_name'] == 'Bob i.'
1200
1201
    def test_api__set_html_document_status__ok_200__nominal_case(self) -> None:
1202
        """
1203
        Get one html document of a content
1204
        """
1205
        self.testapp.authorization = (
1206
            'Basic',
1207
            (
1208
                '[email protected]',
1209
                '[email protected]'
1210
            )
1211
        )
1212
        params = {
1213
            'status': 'closed-deprecated',
1214
        }
1215
1216
        # before
1217
        res = self.testapp.get(
1218
            '/api/v2/workspaces/2/html-documents/6',
1219
            status=200
1220
        )
1221
        content = res.json_body
1222
        assert content['content_type'] == 'html-document'
1223
        assert content['content_id'] == 6
1224
        assert content['status'] == 'open'
1225
1226
        # set status
1227
        self.testapp.put_json(
1228
            '/api/v2/workspaces/2/html-documents/6/status',
1229
            params=params,
1230
            status=204
1231
        )
1232
1233
        # after
1234
        res = self.testapp.get(
1235
            '/api/v2/workspaces/2/html-documents/6',
1236
            status=200
1237
        )
1238
        content = res.json_body
1239
        assert content['content_type'] == 'html-document'
1240
        assert content['content_id'] == 6
1241
        assert content['status'] == 'closed-deprecated'
1242
1243
    def test_api__set_html_document_status__err_400__wrong_status(self) -> None:
1244
        """