Code Duplication    Length = 69-69 lines in 2 locations

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

@@ 2628-2696 (lines=69) @@
2625
            status=400
2626
        )
2627
2628
    def test_api__update_thread__ok_200__nominal_case(self) -> None:
2629
        """
2630
        Update(put) thread
2631
        """
2632
        self.testapp.authorization = (
2633
            'Basic',
2634
            (
2635
                '[email protected]',
2636
                '[email protected]'
2637
            )
2638
        )
2639
        params = {
2640
            'label': 'My New label',
2641
            'raw_content': '<p> Le nouveau contenu </p>',
2642
        }
2643
        res = self.testapp.put_json(
2644
            '/api/v2/workspaces/2/threads/7',
2645
            params=params,
2646
            status=200
2647
        )
2648
        content = res.json_body
2649
        assert content['content_type'] == 'thread'
2650
        assert content['content_id'] == 7
2651
        assert content['is_archived'] is False
2652
        assert content['is_deleted'] is False
2653
        assert content['label'] == 'My New label'
2654
        assert content['parent_id'] == 3
2655
        assert content['show_in_ui'] is True
2656
        assert content['slug'] == 'my-new-label'
2657
        assert content['status'] == 'open'
2658
        assert content['workspace_id'] == 2
2659
        assert content['current_revision_id'] == 28
2660
        # TODO - G.M - 2018-06-173 - check date format
2661
        assert content['created']
2662
        assert content['author']
2663
        assert content['author']['user_id'] == 1
2664
        assert content['author']['avatar_url'] is None
2665
        assert content['author']['public_name'] == 'Global manager'
2666
        # TODO - G.M - 2018-06-173 - check date format
2667
        assert content['modified']
2668
        assert content['last_modifier'] == content['author']
2669
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
2670
2671
        res = self.testapp.get(
2672
            '/api/v2/workspaces/2/threads/7',
2673
            status=200
2674
        )   # nopep8
2675
        content = res.json_body
2676
        assert content['content_type'] == 'thread'
2677
        assert content['content_id'] == 7
2678
        assert content['is_archived'] is False
2679
        assert content['is_deleted'] is False
2680
        assert content['label'] == 'My New label'
2681
        assert content['parent_id'] == 3
2682
        assert content['show_in_ui'] is True
2683
        assert content['slug'] == 'my-new-label'
2684
        assert content['status'] == 'open'
2685
        assert content['workspace_id'] == 2
2686
        assert content['current_revision_id'] == 28
2687
        # TODO - G.M - 2018-06-173 - check date format
2688
        assert content['created']
2689
        assert content['author']
2690
        assert content['author']['user_id'] == 1
2691
        assert content['author']['avatar_url'] is None
2692
        assert content['author']['public_name'] == 'Global manager'
2693
        # TODO - G.M - 2018-06-173 - check date format
2694
        assert content['modified']
2695
        assert content['last_modifier'] == content['author']
2696
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
2697
2698
    def test_api__update_thread__err_400__empty_label(self) -> None:
2699
        """
@@ 1045-1113 (lines=69) @@
1042
            status=400
1043
        )
1044
1045
    def test_api__update_html_document__ok_200__nominal_case(self) -> None:
1046
        """
1047
        Update(put) one html document of a content
1048
        """
1049
        self.testapp.authorization = (
1050
            'Basic',
1051
            (
1052
                '[email protected]',
1053
                '[email protected]'
1054
            )
1055
        )
1056
        params = {
1057
            'label': 'My New label',
1058
            'raw_content': '<p> Le nouveau contenu </p>',
1059
        }
1060
        res = self.testapp.put_json(
1061
            '/api/v2/workspaces/2/html-documents/6',
1062
            params=params,
1063
            status=200
1064
        )
1065
        content = res.json_body
1066
        assert content['content_type'] == 'html-document'
1067
        assert content['content_id'] == 6
1068
        assert content['is_archived'] is False
1069
        assert content['is_deleted'] is False
1070
        assert content['label'] == 'My New label'
1071
        assert content['parent_id'] == 3
1072
        assert content['show_in_ui'] is True
1073
        assert content['slug'] == 'my-new-label'
1074
        assert content['status'] == 'open'
1075
        assert content['workspace_id'] == 2
1076
        assert content['current_revision_id'] == 28
1077
        # TODO - G.M - 2018-06-173 - check date format
1078
        assert content['created']
1079
        assert content['author']
1080
        assert content['author']['user_id'] == 1
1081
        assert content['author']['avatar_url'] is None
1082
        assert content['author']['public_name'] == 'Global manager'
1083
        # TODO - G.M - 2018-06-173 - check date format
1084
        assert content['modified']
1085
        assert content['last_modifier'] == content['author']
1086
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
1087
1088
        res = self.testapp.get(
1089
            '/api/v2/workspaces/2/html-documents/6',
1090
            status=200
1091
        )
1092
        content = res.json_body
1093
        assert content['content_type'] == 'html-document'
1094
        assert content['content_id'] == 6
1095
        assert content['is_archived'] is False
1096
        assert content['is_deleted'] is False
1097
        assert content['label'] == 'My New label'
1098
        assert content['parent_id'] == 3
1099
        assert content['show_in_ui'] is True
1100
        assert content['slug'] == 'my-new-label'
1101
        assert content['status'] == 'open'
1102
        assert content['workspace_id'] == 2
1103
        assert content['current_revision_id'] == 28
1104
        # TODO - G.M - 2018-06-173 - check date format
1105
        assert content['created']
1106
        assert content['author']
1107
        assert content['author']['user_id'] == 1
1108
        assert content['author']['avatar_url'] is None
1109
        assert content['author']['public_name'] == 'Global manager'
1110
        # TODO - G.M - 2018-06-173 - check date format
1111
        assert content['modified']
1112
        assert content['last_modifier'] == content['author']
1113
        assert content['raw_content'] == '<p> Le nouveau contenu </p>'
1114
1115
    def test_api__get_html_document_revisions__ok_200__nominal_case(
1116
            self