1+ import pytest
12from tests .integration import asserts
3+ from threescale_api import errors
24from .asserts import assert_resource , assert_resource_params
35
46
@@ -33,6 +35,9 @@ def test_file_can_be_updated(cms_file_data, cms_file):
3335 """ Can be file object updated? """
3436 updated_path = cms_file ['path' ] + 'up'
3537 cms_file ['path' ] = cms_file ['path' ] + 'up'
38+ # TODO https://issues.redhat.com/browse/THREESCALE-9571
39+ for item in "created_at" , "updated_at" , "url" , "title" , "content_type" :
40+ cms_file .pop (item )
3641 cms_file .update ()
3742 assert cms_file ['path' ] == updated_path
3843 updated = cms_file .read ()
@@ -41,20 +46,6 @@ def test_file_can_be_updated(cms_file_data, cms_file):
4146
4247
4348# Sections
44- # builtin
45-
46- def test_builtin_section_list (api ):
47- """ List all sections. """
48- assert len (api .cms_builtin_sections .list ()) >= 1
49-
50-
51- def test_builtin_section_can_be_read (api ):
52- """ It is possible to get section by ID? """
53- cms_section = api .cms_builtin_sections .list ()[- 1 ]
54- read = api .cms_sections .read (cms_section .entity_id )
55- asserts .assert_resource (read )
56-
57- # user
5849
5950
6051def test_section_list (api , cms_section ):
@@ -79,12 +70,26 @@ def test_section_can_be_updated(cms_section_params, cms_section):
7970 """ Can be section object updated? """
8071 updated_title = cms_section ['title' ] + 'up'
8172 cms_section ['title' ] = cms_section ['title' ] + 'up'
73+ # TODO https://issues.redhat.com/browse/THREESCALE-9571
74+ for item in "created_at" , "updated_at" :
75+ cms_section .pop (item )
8276 cms_section .update ()
8377 assert cms_section ['title' ] == updated_title
8478 updated = cms_section .read ()
8579 assert updated ['title' ] == updated_title
8680 assert cms_section ['title' ] == updated_title
8781
82+
83+ # # bug!!! TODO https://issues.redhat.com/browse/THREESCALE-9572
84+ # def test_builtin_section_delete(api):
85+ # """It is not possible to delete section partial."""
86+ # with pytest.raises(errors.ApiClientError) as exc_info:
87+ # api.cms_sections.list()[0].delete()
88+ # assert exc_info.value.code == 423
89+ # # TODO
90+ # # assert exc_info.value.code == 400
91+
92+
8893# Partials
8994# builtin
9095
@@ -100,6 +105,14 @@ def test_builtin_partial_can_be_read(api):
100105 read = api .cms_builtin_partials .read (cms_partial .entity_id )
101106 asserts .assert_resource (read )
102107
108+ def test_builtin_partial_delete (api ):
109+ """It is not possible to delete builtin partial."""
110+ with pytest .raises (errors .ApiClientError ) as exc_info :
111+ api .cms_builtin_partials .list ()[0 ].delete ()
112+ assert exc_info .value .code == 423
113+ # TODO https://issues.redhat.com/browse/THREESCALE-9572
114+ # assert exc_info.value.code == 400
115+
103116# user
104117
105118
@@ -125,6 +138,9 @@ def test_partial_can_be_updated(cms_partial_params, cms_partial):
125138 """ Can be partial object updated? """
126139 updated_draft = cms_partial ['draft' ] + 'up'
127140 cms_partial ['draft' ] = cms_partial ['draft' ] + 'up'
141+ # TODO https://issues.redhat.com/browse/THREESCALE-9571
142+ for item in "created_at" , "updated_at" , "published" :
143+ cms_partial .pop (item )
128144 cms_partial .update ()
129145 assert cms_partial ['draft' ] == updated_draft
130146 updated = cms_partial .read ()
@@ -158,6 +174,15 @@ def test_builtin_page_can_be_read(api):
158174 asserts .assert_resource (read )
159175
160176
177+ def test_builtin_page_delete (api ):
178+ """It is not possible to delete builtin page."""
179+ with pytest .raises (errors .ApiClientError ) as exc_info :
180+ api .cms_builtin_pages .list ()[0 ].delete ()
181+ assert exc_info .value .code == 423
182+ # TODO https://issues.redhat.com/browse/THREESCALE-9572
183+ # assert exc_info.value.code == 400
184+
185+
161186# user
162187
163188
@@ -183,6 +208,9 @@ def test_page_can_be_updated(cms_page_params, cms_page):
183208 """ Can be page object updated? """
184209 updated_draft = cms_page ['draft' ] + 'up'
185210 cms_page ['draft' ] = cms_page ['draft' ] + 'up'
211+ # TODO https://issues.redhat.com/browse/THREESCALE-9571
212+ for item in "created_at" , "updated_at" , "hidden" , "published" :
213+ cms_page .pop (item )
186214 cms_page .update ()
187215 assert cms_page ['draft' ] == updated_draft
188216 updated = cms_page .read ()
@@ -225,6 +253,9 @@ def test_layout_can_be_updated(cms_layout_params, cms_layout):
225253 """ Can be layout object updated? """
226254 updated_draft = cms_layout ['draft' ] + 'up'
227255 cms_layout ['draft' ] = cms_layout ['draft' ] + 'up'
256+ # TODO https://issues.redhat.com/browse/THREESCALE-9571
257+ for item in "created_at" , "updated_at" , "published" :
258+ cms_layout .pop (item )
228259 cms_layout .update ()
229260 assert cms_layout ['draft' ] == updated_draft
230261 updated = cms_layout .read ()
0 commit comments