Code Duplication    Length = 69-69 lines in 2 locations

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

@@ 1103-1171 (lines=69) @@
1100
            status=400
1101
        )
1102
1103
    def test_api__update_html_document__ok_200__nominal_case(self) -> None:
1104
        """
1105
        Update(put) one html document of a content
1106
        """
1107
        self.testapp.authorization = (
1108
            'Basic',
1109
            (
1110
                '[email protected]',
1111
                '[email protected]'
1112
            )
1113
        )
1114
        params = {
1115
            'label': 'My New label',
1116
            'raw_content': '<p> Le nouveau contenu </p>',
1117
        }
1118
        res = self.testapp.put_json(
1119
            '/api/v2/workspaces/2/html-documents/6',
1120
            params=params,
1121
            status=200
1122
        )
1123
        content = res.json_body
1124
        assert content['content_type'] == 'html-document'
1125
        assert content['content_id'] == 6
1126
        assert content['is_archived'] is False
1127
        assert content['is_deleted'] is False
1128
        assert content['label'] == 'My New label'
1129
        assert content['parent_id'] == 3
1130
        assert content['show_in_ui'] is True
1131
        assert content['slug'] == 'my-new-label'
1132
        assert content['status'] == 'open'
1133
        assert content['workspace_id'] == 2
1134
        assert content['current_revision_id'] == 28
1135
        # TODO - G.M - 2018-06-173 - check date format
1136
        assert content['created']
1137
        assert content['author']
1138
        assert content['author']['user_id'] == 1
1139
        assert content['author']['avatar_url'] is None
1140
        assert content['author']['public_name'] == 'Global manager'
1141
        # TODO - G.M - 2018-06-173 - check date format
1142
        assert content['modified']
1143
        assert content['last_modifier'] == content['author']
1144
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
1145
1146
        res = self.testapp.get(
1147
            '/api/v2/workspaces/2/html-documents/6',
1148
            status=200
1149
        )
1150
        content = res.json_body
1151
        assert content['content_type'] == 'html-document'
1152
        assert content['content_id'] == 6
1153
        assert content['is_archived'] is False
1154
        assert content['is_deleted'] is False
1155
        assert content['label'] == 'My New label'
1156
        assert content['parent_id'] == 3
1157
        assert content['show_in_ui'] is True
1158
        assert content['slug'] == 'my-new-label'
1159
        assert content['status'] == 'open'
1160
        assert content['workspace_id'] == 2
1161
        assert content['current_revision_id'] == 28
1162
        # TODO - G.M - 2018-06-173 - check date format
1163
        assert content['created']
1164
        assert content['author']
1165
        assert content['author']['user_id'] == 1
1166
        assert content['author']['avatar_url'] is None
1167
        assert content['author']['public_name'] == 'Global manager'
1168
        # TODO - G.M - 2018-06-173 - check date format
1169
        assert content['modified']
1170
        assert content['last_modifier'] == content['author']
1171
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
1172
1173
    def test_api__get_html_document_revisions__ok_200__nominal_case(
1174
            self
@@ 3767-3835 (lines=69) @@
3764
            status=400
3765
        )
3766
3767
    def test_api__update_thread__ok_200__nominal_case(self) -> None:
3768
        """
3769
        Update(put) thread
3770
        """
3771
        self.testapp.authorization = (
3772
            'Basic',
3773
            (
3774
                '[email protected]',
3775
                '[email protected]'
3776
            )
3777
        )
3778
        params = {
3779
            'label': 'My New label',
3780
            'raw_content': '<p> Le nouveau contenu </p>',
3781
        }
3782
        res = self.testapp.put_json(
3783
            '/api/v2/workspaces/2/threads/7',
3784
            params=params,
3785
            status=200
3786
        )
3787
        content = res.json_body
3788
        assert content['content_type'] == 'thread'
3789
        assert content['content_id'] == 7
3790
        assert content['is_archived'] is False
3791
        assert content['is_deleted'] is False
3792
        assert content['label'] == 'My New label'
3793
        assert content['parent_id'] == 3
3794
        assert content['show_in_ui'] is True
3795
        assert content['slug'] == 'my-new-label'
3796
        assert content['status'] == 'open'
3797
        assert content['workspace_id'] == 2
3798
        assert content['current_revision_id'] == 28
3799
        # TODO - G.M - 2018-06-173 - check date format
3800
        assert content['created']
3801
        assert content['author']
3802
        assert content['author']['user_id'] == 1
3803
        assert content['author']['avatar_url'] is None
3804
        assert content['author']['public_name'] == 'Global manager'
3805
        # TODO - G.M - 2018-06-173 - check date format
3806
        assert content['modified']
3807
        assert content['last_modifier'] == content['author']
3808
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
3809
3810
        res = self.testapp.get(
3811
            '/api/v2/workspaces/2/threads/7',
3812
            status=200
3813
        )   # nopep8
3814
        content = res.json_body
3815
        assert content['content_type'] == 'thread'
3816
        assert content['content_id'] == 7
3817
        assert content['is_archived'] is False
3818
        assert content['is_deleted'] is False
3819
        assert content['label'] == 'My New label'
3820
        assert content['parent_id'] == 3
3821
        assert content['show_in_ui'] is True
3822
        assert content['slug'] == 'my-new-label'
3823
        assert content['status'] == 'open'
3824
        assert content['workspace_id'] == 2
3825
        assert content['current_revision_id'] == 28
3826
        # TODO - G.M - 2018-06-173 - check date format
3827
        assert content['created']
3828
        assert content['author']
3829
        assert content['author']['user_id'] == 1
3830
        assert content['author']['avatar_url'] is None
3831
        assert content['author']['public_name'] == 'Global manager'
3832
        # TODO - G.M - 2018-06-173 - check date format
3833
        assert content['modified']
3834
        assert content['last_modifier'] == content['author']
3835
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
3836
3837
    def test_api__update_thread__err_400__empty_label(self) -> None:
3838
        """