Skip to content

Commit a819350

Browse files
KumarGanesanIBMGitHub Enterprise
authored andcommitted
Issue#3954 (#13)
* changes done after combining specs * dns record typo error * zone setting update minfiy setting
1 parent 45ad4d6 commit a819350

File tree

3 files changed

+52
-47
lines changed

3 files changed

+52
-47
lines changed

ibm_cloud_networking_services/zones_settings_v1.py

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def update_zone_cname_flattening(self, *, accept: str = None, value: str = None,
246246

247247
def get_opportunistic_encryption(self, *, accept: str = None, **kwargs) -> DetailedResponse:
248248
"""
249-
get opportunistic encryption setting.
249+
Get opportunistic encryption setting.
250250
251251
Get opportunistic encryption setting for a zone.
252252
@@ -317,7 +317,7 @@ def update_opportunistic_encryption(self, *, accept: str = None, value: str = No
317317

318318
def get_challenge_ttl(self, *, accept: str = None, **kwargs) -> DetailedResponse:
319319
"""
320-
get challenge TTL setting.
320+
Get challenge TTL setting.
321321
322322
Get challenge TTL setting for a zone.
323323
@@ -388,7 +388,7 @@ def update_challenge_ttl(self, *, accept: str = None, value: int = None, **kwarg
388388

389389
def get_automatic_https_rewrites(self, *, accept: str = None, **kwargs) -> DetailedResponse:
390390
"""
391-
get automatic https rewrites setting.
391+
Get automatic https rewrites setting.
392392
393393
Get automatic https rewrites setting for a zone.
394394
@@ -459,7 +459,7 @@ def update_automatic_https_rewrites(self, *, accept: str = None, value: str = No
459459

460460
def get_ture_client_ip(self, *, accept: str = None, **kwargs) -> DetailedResponse:
461461
"""
462-
get true client IP setting.
462+
Get true client IP setting.
463463
464464
Get true client IP setting for a zone.
465465
@@ -530,7 +530,7 @@ def update_true_client_ip(self, *, accept: str = None, value: str = None, **kwar
530530

531531
def get_always_use_https(self, *, accept: str = None, **kwargs) -> DetailedResponse:
532532
"""
533-
get always use https setting.
533+
Get always use https setting.
534534
535535
Get always use https setting for a zone.
536536
@@ -601,7 +601,7 @@ def update_always_use_https(self, *, accept: str = None, value: str = None, **kw
601601

602602
def get_image_size_optimization(self, *, accept: str = None, **kwargs) -> DetailedResponse:
603603
"""
604-
get image size optimization setting.
604+
Get image size optimization setting.
605605
606606
Get image size optimization setting for a zone.
607607
@@ -676,7 +676,7 @@ def update_image_size_optimization(self, *, accept: str = None, value: str = Non
676676

677677
def get_script_load_optimization(self, *, accept: str = None, **kwargs) -> DetailedResponse:
678678
"""
679-
get script load optimization setting.
679+
Get script load optimization setting.
680680
681681
Get script load optimization setting for a zone.
682682
@@ -747,7 +747,7 @@ def update_script_load_optimization(self, *, accept: str = None, value: str = No
747747

748748
def get_image_load_optimization(self, *, accept: str = None, **kwargs) -> DetailedResponse:
749749
"""
750-
get image load optimizationn setting.
750+
Get image load optimizationn setting.
751751
752752
Get image load optimizationn setting for a zone.
753753
@@ -818,7 +818,7 @@ def update_image_load_optimization(self, *, accept: str = None, value: str = Non
818818

819819
def get_minify(self, *, accept: str = None, **kwargs) -> DetailedResponse:
820820
"""
821-
get minify setting.
821+
Get minify setting.
822822
823823
Get minify setting for a zone.
824824
@@ -846,9 +846,7 @@ def get_minify(self, *, accept: str = None, **kwargs) -> DetailedResponse:
846846
response = self.send(request)
847847
return response
848848

849-
850-
851-
def update_minify(self, *, accept: str = None, css: str = None, html: str = None, js: str = None, **kwargs) -> DetailedResponse:
849+
def update_minify(self, *, accept: str = None, value: 'MinifySettingValue' = None, **kwargs) -> DetailedResponse:
852850
"""
853851
Update minify setting.
854852
@@ -862,17 +860,17 @@ def update_minify(self, *, accept: str = None, css: str = None, html: str = None
862860
:rtype: DetailedResponse with `dict` result representing a `MinifyResp` object
863861
"""
864862

863+
if value is not None:
864+
value = convert_model(value)
865865
headers = {
866866
'Accept': accept
867867
}
868868
sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_minify')
869869
headers.update(sdk_headers)
870870

871-
data = {'value': {
872-
'css': css,
873-
'html': html,
874-
'js': js
875-
}}
871+
data = {
872+
'value': value
873+
}
876874
data = {k: v for (k, v) in data.items() if v is not None}
877875
data = json.dumps(data)
878876
headers['content-type'] = 'application/json'
@@ -892,7 +890,7 @@ def update_minify(self, *, accept: str = None, css: str = None, html: str = None
892890

893891
def get_min_tls_version(self, *, accept: str = None, **kwargs) -> DetailedResponse:
894892
"""
895-
get minimum TLS version setting.
893+
Get minimum TLS version setting.
896894
897895
Get minimum TLS version setting for a zone.
898896
@@ -963,7 +961,7 @@ def update_min_tls_version(self, *, accept: str = None, value: str = None, **kwa
963961

964962
def get_ip_geolocation(self, *, accept: str = None, **kwargs) -> DetailedResponse:
965963
"""
966-
get IP geolocation setting.
964+
Get IP geolocation setting.
967965
968966
Get IP geolocation setting for a zone.
969967
@@ -1034,7 +1032,7 @@ def update_ip_geolocation(self, *, accept: str = None, value: str = None, **kwar
10341032

10351033
def get_server_side_exclude(self, *, accept: str = None, **kwargs) -> DetailedResponse:
10361034
"""
1037-
get server side exclude setting.
1035+
Get server side exclude setting.
10381036
10391037
Get server side exclude setting for a zone.
10401038
@@ -1105,7 +1103,7 @@ def update_server_side_exclude(self, *, accept: str = None, value: str = None, *
11051103

11061104
def get_security_header(self, *, accept: str = None, **kwargs) -> DetailedResponse:
11071105
"""
1108-
get HTTP strict transport security setting.
1106+
Get HTTP strict transport security setting.
11091107
11101108
Get HTTP strict transport security setting for a zone.
11111109
@@ -1178,7 +1176,7 @@ def update_security_header(self, *, accept: str = None, value: 'SecurityHeaderSe
11781176

11791177
def get_mobile_redirect(self, *, accept: str = None, **kwargs) -> DetailedResponse:
11801178
"""
1181-
get mobile redirect setting.
1179+
Get mobile redirect setting.
11821180
11831181
Get mobile redirect setting for a zone.
11841182
@@ -1251,7 +1249,7 @@ def update_mobile_redirect(self, *, accept: str = None, value: 'MobileRedirecSet
12511249

12521250
def get_prefetch_preload(self, *, accept: str = None, **kwargs) -> DetailedResponse:
12531251
"""
1254-
get prefetch URLs from header setting.
1252+
Get prefetch URLs from header setting.
12551253
12561254
Get prefetch URLs from header setting for a zone.
12571255
@@ -1322,7 +1320,7 @@ def update_prefetch_preload(self, *, accept: str = None, value: str = None, **kw
13221320

13231321
def get_http2(self, *, accept: str = None, **kwargs) -> DetailedResponse:
13241322
"""
1325-
get http/2 setting.
1323+
Get http/2 setting.
13261324
13271325
Get http/2 setting for a zone.
13281326
@@ -1393,7 +1391,7 @@ def update_http2(self, *, accept: str = None, value: str = None, **kwargs) -> De
13931391

13941392
def get_ipv6(self, *, accept: str = None, **kwargs) -> DetailedResponse:
13951393
"""
1396-
get IPv6 compatibility setting.
1394+
Get IPv6 compatibility setting.
13971395
13981396
Get IPv6 compatibility setting for a zone.
13991397
@@ -1464,7 +1462,7 @@ def update_ipv6(self, *, accept: str = None, value: str = None, **kwargs) -> Det
14641462

14651463
def get_web_sockets(self, *, accept: str = None, **kwargs) -> DetailedResponse:
14661464
"""
1467-
get web sockets setting.
1465+
Get web sockets setting.
14681466
14691467
Get web sockets setting for a zone.
14701468
@@ -1535,7 +1533,7 @@ def update_web_sockets(self, *, accept: str = None, value: str = None, **kwargs)
15351533

15361534
def get_pseudo_ipv4(self, *, accept: str = None, **kwargs) -> DetailedResponse:
15371535
"""
1538-
get pseudo IPv4 setting.
1536+
Get pseudo IPv4 setting.
15391537
15401538
Get pseudo IPv4 setting for a zone.
15411539
@@ -1606,7 +1604,7 @@ def update_pseudo_ipv4(self, *, accept: str = None, value: str = None, **kwargs)
16061604

16071605
def get_response_buffering(self, *, accept: str = None, **kwargs) -> DetailedResponse:
16081606
"""
1609-
get response buffering setting.
1607+
Get response buffering setting.
16101608
16111609
Get response buffering setting for a zone.
16121610
@@ -1677,7 +1675,7 @@ def update_response_buffering(self, *, accept: str = None, value: str = None, **
16771675

16781676
def get_hotlink_protection(self, *, accept: str = None, **kwargs) -> DetailedResponse:
16791677
"""
1680-
get hotlink protection setting.
1678+
Get hotlink protection setting.
16811679
16821680
Get hotlink protection setting for a zone.
16831681
@@ -1748,7 +1746,7 @@ def update_hotlink_protection(self, *, accept: str = None, value: str = None, **
17481746

17491747
def get_max_upload(self, *, accept: str = None, **kwargs) -> DetailedResponse:
17501748
"""
1751-
get maximum upload size setting.
1749+
Get maximum upload size setting.
17521750
17531751
Get maximum upload size setting for a zone.
17541752
@@ -1822,7 +1820,7 @@ def update_max_upload(self, *, accept: str = None, value: int = None, **kwargs)
18221820

18231821
def get_tls_client_auth(self, *, accept: str = None, **kwargs) -> DetailedResponse:
18241822
"""
1825-
get TLS Client Auth setting.
1823+
Get TLS Client Auth setting.
18261824
18271825
Get TLS Client Auth setting for a zone.
18281826
@@ -1893,7 +1891,7 @@ def update_tls_client_auth(self, *, accept: str = None, value: str = None, **kwa
18931891

18941892
def get_browser_check(self, *, accept: str = None, **kwargs) -> DetailedResponse:
18951893
"""
1896-
get browser check setting.
1894+
Get browser check setting.
18971895
18981896
Get browser check setting for a zone.
18991897
@@ -1964,7 +1962,7 @@ def update_browser_check(self, *, accept: str = None, value: str = None, **kwarg
19641962

19651963
def get_enable_error_pages_on(self, **kwargs) -> DetailedResponse:
19661964
"""
1967-
get enable error pages on setting.
1965+
Get enable error pages on setting.
19681966
19691967
Get enable error pages on setting for a zone.
19701968
@@ -2031,7 +2029,7 @@ def update_enable_error_pages_on(self, *, accept: str = None, value: str = None,
20312029

20322030
def get_web_application_firewall(self, *, accept: str = None, **kwargs) -> DetailedResponse:
20332031
"""
2034-
get web application firewall setting.
2032+
Get web application firewall setting.
20352033
20362034
Get web application firewall setting for a zone.
20372035
@@ -2102,7 +2100,7 @@ def update_web_application_firewall(self, *, accept: str = None, value: str = No
21022100

21032101
def get_ciphers(self, *, accept: str = None, **kwargs) -> DetailedResponse:
21042102
"""
2105-
get ciphers setting.
2103+
Get ciphers setting.
21062104
21072105
Get ciphers setting for a zone.
21082106

test/integration/test_zone_settings_v1.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,19 @@ def test_1_minify_setting(self):
166166
response = self.zonesSettings.get_minify().get_result()
167167
assert response is not None and response.get('success') is True
168168
result = response.get('result').get('value')
169-
if result.get('css') == 'off':
170-
self.value = 'on'
169+
if result.get('css') == 'on':
170+
self.value = 'off'
171171
else:
172172
self.value = 'on'
173173

174174
""" Update minify css setting """
175+
self.minfy = {
176+
'css': self.value,
177+
'html': self.value,
178+
'js': self.value
179+
}
175180
response = self.zonesSettings.update_minify(
176-
css=self.value, html=self.value, js=self.value).get_result()
181+
value=self.minfy).get_result()
177182
assert response is not None and response.get('success') is True
178183

179184
def test_1_min_tls_setting(self):

test/unit/test_zones_settings_v1.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,27 +1252,29 @@ def test_update_minify_all_params(self):
12521252
content_type='*/*',
12531253
status=200)
12541254

1255+
# Construct a dict representation of a MinifySettingValue model
1256+
minify_setting_value_model = {
1257+
'css': 'false',
1258+
'html': 'false',
1259+
'js': 'false'
1260+
}
1261+
12551262
# Set up parameter values
12561263
accept = 'testString'
1257-
css = 'false'
1258-
html = 'false'
1259-
js = 'false'
1264+
value = minify_setting_value_model
12601265

12611266
# Invoke method
12621267
response = service.update_minify(
12631268
accept=accept,
1264-
css=css,
1265-
html=html,
1266-
js=js,
1269+
value=value,
12671270
)
1271+
12681272
# Check for correct operation
12691273
assert len(responses.calls) == 1
12701274
assert response.status_code == 200
12711275
# Validate body params
12721276
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
1273-
assert req_body.get("value")['css'] == css
1274-
assert req_body.get("value")['html'] == html
1275-
assert req_body.get("value")['js'] == js
1277+
assert req_body['value'] == value
12761278

12771279

12781280
#--------------------------------------------------------

0 commit comments

Comments
 (0)