Code Duplication    Length = 69-69 lines in 2 locations

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

@@ 1046-1114 (lines=69) @@
1043
            status=400
1044
        )
1045
1046
    def test_api__update_html_document__ok_200__nominal_case(self) -> None:
1047
        """
1048
        Update(put) one html document of a content
1049
        """
1050
        self.testapp.authorization = (
1051
            'Basic',
1052
            (
1053
                '[email protected]',
1054
                '[email protected]'
1055
            )
1056
        )
1057
        params = {
1058
            'label': 'My New label',
1059
            'raw_content': '<p> Le nouveau contenu </p>',
1060
        }
1061
        res = self.testapp.put_json(
1062
            '/api/v2/workspaces/2/html-documents/6',
1063
            params=params,
1064
            status=200
1065
        )
1066
        content = res.json_body
1067
        assert content['content_type'] == 'html-document'
1068
        assert content['content_id'] == 6
1069
        assert content['is_archived'] is False
1070
        assert content['is_deleted'] is False
1071
        assert content['label'] == 'My New label'
1072
        assert content['parent_id'] == 3
1073
        assert content['show_in_ui'] is True
1074
        assert content['slug'] == 'my-new-label'
1075
        assert content['status'] == 'open'
1076
        assert content['workspace_id'] == 2
1077
        assert content['current_revision_id'] == 28
1078
        # TODO - G.M - 2018-06-173 - check date format
1079
        assert content['created']
1080
        assert content['author']
1081
        assert content['author']['user_id'] == 1
1082
        assert content['author']['avatar_url'] is None
1083
        assert content['author']['public_name'] == 'Global manager'
1084
        # TODO - G.M - 2018-06-173 - check date format
1085
        assert content['modified']
1086
        assert content['last_modifier'] == content['author']
1087
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
1088
1089
        res = self.testapp.get(
1090
            '/api/v2/workspaces/2/html-documents/6',
1091
            status=200
1092
        )
1093
        content = res.json_body
1094
        assert content['content_type'] == 'html-document'
1095
        assert content['content_id'] == 6
1096
        assert content['is_archived'] is False
1097
        assert content['is_deleted'] is False
1098
        assert content['label'] == 'My New label'
1099
        assert content['parent_id'] == 3
1100
        assert content['show_in_ui'] is True
1101
        assert content['slug'] == 'my-new-label'
1102
        assert content['status'] == 'open'
1103
        assert content['workspace_id'] == 2
1104
        assert content['current_revision_id'] == 28
1105
        # TODO - G.M - 2018-06-173 - check date format
1106
        assert content['created']
1107
        assert content['author']
1108
        assert content['author']['user_id'] == 1
1109
        assert content['author']['avatar_url'] is None
1110
        assert content['author']['public_name'] == 'Global manager'
1111
        # TODO - G.M - 2018-06-173 - check date format
1112
        assert content['modified']
1113
        assert content['last_modifier'] == content['author']
1114
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
1115
1116
    def test_api__get_html_document_revisions__ok_200__nominal_case(
1117
            self
@@ 2711-2779 (lines=69) @@
2708
            status=400
2709
        )
2710
2711
    def test_api__update_thread__ok_200__nominal_case(self) -> None:
2712
        """
2713
        Update(put) thread
2714
        """
2715
        self.testapp.authorization = (
2716
            'Basic',
2717
            (
2718
                '[email protected]',
2719
                '[email protected]'
2720
            )
2721
        )
2722
        params = {
2723
            'label': 'My New label',
2724
            'raw_content': '<p> Le nouveau contenu </p>',
2725
        }
2726
        res = self.testapp.put_json(
2727
            '/api/v2/workspaces/2/threads/7',
2728
            params=params,
2729
            status=200
2730
        )
2731
        content = res.json_body
2732
        assert content['content_type'] == 'thread'
2733
        assert content['content_id'] == 7
2734
        assert content['is_archived'] is False
2735
        assert content['is_deleted'] is False
2736
        assert content['label'] == 'My New label'
2737
        assert content['parent_id'] == 3
2738
        assert content['show_in_ui'] is True
2739
        assert content['slug'] == 'my-new-label'
2740
        assert content['status'] == 'open'
2741
        assert content['workspace_id'] == 2
2742
        assert content['current_revision_id'] == 28
2743
        # TODO - G.M - 2018-06-173 - check date format
2744
        assert content['created']
2745
        assert content['author']
2746
        assert content['author']['user_id'] == 1
2747
        assert content['author']['avatar_url'] is None
2748
        assert content['author']['public_name'] == 'Global manager'
2749
        # TODO - G.M - 2018-06-173 - check date format
2750
        assert content['modified']
2751
        assert content['last_modifier'] == content['author']
2752
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
2753
2754
        res = self.testapp.get(
2755
            '/api/v2/workspaces/2/threads/7',
2756
            status=200
2757
        )   # nopep8
2758
        content = res.json_body
2759
        assert content['content_type'] == 'thread'
2760
        assert content['content_id'] == 7
2761
        assert content['is_archived'] is False
2762
        assert content['is_deleted'] is False
2763
        assert content['label'] == 'My New label'
2764
        assert content['parent_id'] == 3
2765
        assert content['show_in_ui'] is True
2766
        assert content['slug'] == 'my-new-label'
2767
        assert content['status'] == 'open'
2768
        assert content['workspace_id'] == 2
2769
        assert content['current_revision_id'] == 28
2770
        # TODO - G.M - 2018-06-173 - check date format
2771
        assert content['created']
2772
        assert content['author']
2773
        assert content['author']['user_id'] == 1
2774
        assert content['author']['avatar_url'] is None
2775
        assert content['author']['public_name'] == 'Global manager'
2776
        # TODO - G.M - 2018-06-173 - check date format
2777
        assert content['modified']
2778
        assert content['last_modifier'] == content['author']
2779
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
2780
2781
    def test_api__update_thread__err_400__empty_label(self) -> None:
2782
        """