Code Duplication    Length = 42-43 lines in 2 locations

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

@@ 1030-1071 (lines=42) @@
1027
        assert content['raw_content'] == '<p>To cook a great Tiramisu, you need many ingredients.</p>'  # nopep8
1028
        assert content['file_extension'] == '.document.html'
1029
1030
    def test_api__get_html_document__ok_200__nominal_case(self) -> None:
1031
        """
1032
        Get one html document of a content
1033
        """
1034
        self.testapp.authorization = (
1035
            'Basic',
1036
            (
1037
                '[email protected]',
1038
                '[email protected]'
1039
            )
1040
        )
1041
        res = self.testapp.get(
1042
            '/api/v2/workspaces/2/html-documents/6',
1043
            status=200
1044
        )
1045
        content = res.json_body
1046
        assert content['content_type'] == 'html-document'
1047
        assert content['content_id'] == 6
1048
        assert content['is_archived'] is False
1049
        assert content['is_deleted'] is False
1050
        assert content['is_editable'] is True
1051
        assert content['label'] == 'Tiramisu Recipe'
1052
        assert content['parent_id'] == 3
1053
        assert content['show_in_ui'] is True
1054
        assert content['slug'] == 'tiramisu-recipe'
1055
        assert content['status'] == 'open'
1056
        assert content['workspace_id'] == 2
1057
        assert content['current_revision_id'] == 27
1058
        # TODO - G.M - 2018-06-173 - check date format
1059
        assert content['created']
1060
        assert content['author']
1061
        assert content['author']['user_id'] == 1
1062
        assert content['author']['avatar_url'] is None
1063
        assert content['author']['public_name'] == 'Global manager'
1064
        # TODO - G.M - 2018-06-173 - check date format
1065
        assert content['modified']
1066
        assert content['last_modifier'] != content['author']
1067
        assert content['last_modifier']['user_id'] == 3
1068
        assert content['last_modifier']['public_name'] == 'Bob i.'
1069
        assert content['last_modifier']['avatar_url'] is None
1070
        assert content['raw_content'] == '<p>To cook a great Tiramisu, you need many ingredients.</p>'  # nopep8
1071
        assert content['file_extension'] == '.document.html'
1072
1073
    def test_api__get_html_document__ok_200__archived_content(self) -> None:
1074
        """
@@ 5114-5156 (lines=43) @@
5111
        assert 'code' in res.json_body
5112
        assert res.json_body['code'] == error.CONTENT_TYPE_NOT_ALLOWED
5113
5114
    def test_api__get_thread__ok_200__nominal_case(self) -> None:
5115
        """
5116
        Get one html document of a content
5117
        """
5118
        self.testapp.authorization = (
5119
            'Basic',
5120
            (
5121
                '[email protected]',
5122
                '[email protected]'
5123
            )
5124
        )
5125
        res = self.testapp.get(
5126
            '/api/v2/workspaces/2/threads/7',
5127
            status=200
5128
        )   # nopep8
5129
        content = res.json_body
5130
        assert content['content_type'] == 'thread'
5131
        assert content['content_id'] == 7
5132
        assert content['is_archived'] is False
5133
        assert content['is_deleted'] is False
5134
        assert content['is_editable'] is True
5135
        assert content['label'] == 'Best Cakes?'
5136
        assert content['parent_id'] == 3
5137
        assert content['show_in_ui'] is True
5138
        assert content['slug'] == 'best-cakes'
5139
        assert content['status'] == 'open'
5140
        assert content['workspace_id'] == 2
5141
        assert content['current_revision_id'] == 26
5142
        # TODO - G.M - 2018-06-173 - check date format
5143
        assert content['created']
5144
        assert content['author']
5145
        assert content['author']['user_id'] == 1
5146
        assert content['author']['avatar_url'] is None
5147
        assert content['author']['public_name'] == 'Global manager'
5148
        # TODO - G.M - 2018-06-173 - check date format
5149
        assert content['modified']
5150
        assert content['last_modifier'] != content['author']
5151
        assert content['last_modifier']['user_id'] == 3
5152
        assert content['last_modifier']['public_name'] == 'Bob i.'
5153
        assert content['last_modifier']['avatar_url'] is None
5154
        assert content['raw_content'] == 'What is the best cake?'  # nopep8
5155
        assert content['file_extension'] == '.thread.html'
5156
        assert content['filename'] == 'Best Cakes?.thread.html'
5157
5158
    def test_api__get_thread__err_400__content_does_not_exist(self) -> None:
5159
        """