@@ 2960-3007 (lines=48) @@ | ||
2957 | active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
|
2958 | assert res.json_body in active_contents |
|
2959 | ||
2960 | def test_api__post_content_create_generic_content__err_400__label_already_used(self) -> None: # nopep8 |
|
2961 | """ |
|
2962 | Create generic content |
|
2963 | """ |
|
2964 | self.testapp.authorization = ( |
|
2965 | 'Basic', |
|
2966 | ( |
|
2967 | '[email protected]', |
|
2968 | '[email protected]' |
|
2969 | ) |
|
2970 | ) |
|
2971 | params = { |
|
2972 | 'parent_id': None, |
|
2973 | 'label': 'GenericCreatedContent', |
|
2974 | 'content_type': 'html-document', |
|
2975 | } |
|
2976 | res = self.testapp.post_json( |
|
2977 | '/api/v2/workspaces/1/contents', |
|
2978 | params=params, |
|
2979 | status=200 |
|
2980 | ) |
|
2981 | assert res |
|
2982 | assert res.json_body |
|
2983 | assert res.json_body['status'] == 'open' |
|
2984 | assert res.json_body['content_id'] |
|
2985 | assert res.json_body['content_type'] == 'html-document' |
|
2986 | assert res.json_body['is_archived'] is False |
|
2987 | assert res.json_body['is_deleted'] is False |
|
2988 | assert res.json_body['workspace_id'] == 1 |
|
2989 | assert res.json_body['slug'] == 'genericcreatedcontent' |
|
2990 | assert res.json_body['parent_id'] is None |
|
2991 | assert res.json_body['show_in_ui'] is True |
|
2992 | assert res.json_body['sub_content_types'] |
|
2993 | params_active = { |
|
2994 | 'parent_id': 0, |
|
2995 | 'show_archived': 0, |
|
2996 | 'show_deleted': 0, |
|
2997 | 'show_active': 1, |
|
2998 | } |
|
2999 | # INFO - G.M - 2018-06-165 - Verify if new content is correctly created |
|
3000 | active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
|
3001 | assert res.json_body in active_contents |
|
3002 | ||
3003 | # recreate same content |
|
3004 | self.testapp.post_json( |
|
3005 | '/api/v2/workspaces/1/contents', |
|
3006 | params=params, |
|
3007 | status=400 |
|
3008 | ) |
|
3009 | ||
3010 | def test_api__post_content_create_generic_content__ok_200__no_parent_id_param(self) -> None: # nopep8 |
|
@@ 3074-3115 (lines=42) @@ | ||
3071 | status=400 |
|
3072 | ) |
|
3073 | ||
3074 | def test_api__post_content_create_generic_content__ok_200__in_folder(self) -> None: # nopep8 |
|
3075 | """ |
|
3076 | Create generic content in folder |
|
3077 | """ |
|
3078 | self.testapp.authorization = ( |
|
3079 | 'Basic', |
|
3080 | ( |
|
3081 | '[email protected]', |
|
3082 | '[email protected]' |
|
3083 | ) |
|
3084 | ) |
|
3085 | params = { |
|
3086 | 'label': 'GenericCreatedContent', |
|
3087 | 'content_type': 'html-document', |
|
3088 | 'parent_id': 10, |
|
3089 | } |
|
3090 | res = self.testapp.post_json( |
|
3091 | '/api/v2/workspaces/1/contents', |
|
3092 | params=params, |
|
3093 | status=200 |
|
3094 | ) |
|
3095 | assert res |
|
3096 | assert res.json_body |
|
3097 | assert res.json_body['status'] == 'open' |
|
3098 | assert res.json_body['content_id'] |
|
3099 | assert res.json_body['content_type'] == 'html-document' |
|
3100 | assert res.json_body['is_archived'] is False |
|
3101 | assert res.json_body['is_deleted'] is False |
|
3102 | assert res.json_body['workspace_id'] == 1 |
|
3103 | assert res.json_body['slug'] == 'genericcreatedcontent' |
|
3104 | assert res.json_body['parent_id'] == 10 |
|
3105 | assert res.json_body['show_in_ui'] is True |
|
3106 | assert res.json_body['sub_content_types'] |
|
3107 | params_active = { |
|
3108 | 'parent_id': 10, |
|
3109 | 'show_archived': 0, |
|
3110 | 'show_deleted': 0, |
|
3111 | 'show_active': 1, |
|
3112 | } |
|
3113 | # INFO - G.M - 2018-06-165 - Verify if new content is correctly created |
|
3114 | active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
|
3115 | assert res.json_body in active_contents |
|
3116 | ||
3117 | def test_api__post_content_create_generic_content__err_400__empty_label(self) -> None: # nopep8 |
|
3118 | """ |
|
@@ 2917-2958 (lines=42) @@ | ||
2914 | assert 'message' in res.json.keys() |
|
2915 | assert 'details' in res.json.keys() |
|
2916 | ||
2917 | def test_api__post_content_create_generic_content__ok_200__nominal_case(self) -> None: # nopep8 |
|
2918 | """ |
|
2919 | Create generic content |
|
2920 | """ |
|
2921 | self.testapp.authorization = ( |
|
2922 | 'Basic', |
|
2923 | ( |
|
2924 | '[email protected]', |
|
2925 | '[email protected]' |
|
2926 | ) |
|
2927 | ) |
|
2928 | params = { |
|
2929 | 'parent_id': None, |
|
2930 | 'label': 'GenericCreatedContent', |
|
2931 | 'content_type': 'html-document', |
|
2932 | } |
|
2933 | res = self.testapp.post_json( |
|
2934 | '/api/v2/workspaces/1/contents', |
|
2935 | params=params, |
|
2936 | status=200 |
|
2937 | ) |
|
2938 | assert res |
|
2939 | assert res.json_body |
|
2940 | assert res.json_body['status'] == 'open' |
|
2941 | assert res.json_body['content_id'] |
|
2942 | assert res.json_body['content_type'] == 'html-document' |
|
2943 | assert res.json_body['is_archived'] is False |
|
2944 | assert res.json_body['is_deleted'] is False |
|
2945 | assert res.json_body['workspace_id'] == 1 |
|
2946 | assert res.json_body['slug'] == 'genericcreatedcontent' |
|
2947 | assert res.json_body['parent_id'] is None |
|
2948 | assert res.json_body['show_in_ui'] is True |
|
2949 | assert res.json_body['sub_content_types'] |
|
2950 | params_active = { |
|
2951 | 'parent_id': 0, |
|
2952 | 'show_archived': 0, |
|
2953 | 'show_deleted': 0, |
|
2954 | 'show_active': 1, |
|
2955 | } |
|
2956 | # INFO - G.M - 2018-06-165 - Verify if new content is correctly created |
|
2957 | active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
|
2958 | assert res.json_body in active_contents |
|
2959 | ||
2960 | def test_api__post_content_create_generic_content__err_400__label_already_used(self) -> None: # nopep8 |
|
2961 | """ |
|
@@ 3010-3050 (lines=41) @@ | ||
3007 | status=400 |
|
3008 | ) |
|
3009 | ||
3010 | def test_api__post_content_create_generic_content__ok_200__no_parent_id_param(self) -> None: # nopep8 |
|
3011 | """ |
|
3012 | Create generic content |
|
3013 | """ |
|
3014 | self.testapp.authorization = ( |
|
3015 | 'Basic', |
|
3016 | ( |
|
3017 | '[email protected]', |
|
3018 | '[email protected]' |
|
3019 | ) |
|
3020 | ) |
|
3021 | params = { |
|
3022 | 'label': 'GenericCreatedContent', |
|
3023 | 'content_type': 'html-document', |
|
3024 | } |
|
3025 | res = self.testapp.post_json( |
|
3026 | '/api/v2/workspaces/1/contents', |
|
3027 | params=params, |
|
3028 | status=200 |
|
3029 | ) |
|
3030 | assert res |
|
3031 | assert res.json_body |
|
3032 | assert res.json_body['status'] == 'open' |
|
3033 | assert res.json_body['content_id'] |
|
3034 | assert res.json_body['content_type'] == 'html-document' |
|
3035 | assert res.json_body['is_archived'] is False |
|
3036 | assert res.json_body['is_deleted'] is False |
|
3037 | assert res.json_body['workspace_id'] == 1 |
|
3038 | assert res.json_body['slug'] == 'genericcreatedcontent' |
|
3039 | assert res.json_body['parent_id'] is None |
|
3040 | assert res.json_body['show_in_ui'] is True |
|
3041 | assert res.json_body['sub_content_types'] |
|
3042 | params_active = { |
|
3043 | 'parent_id': 0, |
|
3044 | 'show_archived': 0, |
|
3045 | 'show_deleted': 0, |
|
3046 | 'show_active': 1, |
|
3047 | } |
|
3048 | # INFO - G.M - 2018-06-165 - Verify if new content is correctly created |
|
3049 | active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8 |
|
3050 | assert res.json_body in active_contents |
|
3051 | ||
3052 | def test_api__post_content_create_generic_content__err_400__parent_id_0(self) -> None: # nopep8 |
|
3053 | """ |