@@ -4221,6 +4221,117 @@ def test_update_custom_resolver_value_error(self):
4221
4221
4222
4222
4223
4223
4224
+ class TestUpdateCrLocationsOrder ():
4225
+ """
4226
+ Test Class for update_cr_locations_order
4227
+ """
4228
+
4229
+ def preprocess_url (self , request_url : str ):
4230
+ """
4231
+ Preprocess the request URL to ensure the mock response will be found.
4232
+ """
4233
+ if re .fullmatch ('.*/+' , request_url ) is None :
4234
+ return request_url
4235
+ else :
4236
+ return re .compile (request_url .rstrip ('/' ) + '/+' )
4237
+
4238
+ @responses .activate
4239
+ def test_update_cr_locations_order_all_params (self ):
4240
+ """
4241
+ update_cr_locations_order()
4242
+ """
4243
+ # Set up mock
4244
+ url = self .preprocess_url (_base_url + '/instances/testString/custom_resolvers/testString/locations_order' )
4245
+ mock_response = '{"id": "5365b73c-ce6f-4d6f-ad9f-d9c131b26370", "name": "my-resolver", "description": "custom resolver", "enabled": false, "health": "HEALTHY", "locations": [{"id": "9a234ede-c2b6-4c39-bc27-d39ec139ecdb", "subnet_crn": "crn:v1:bluemix:public:is:us-south-1:a/01652b251c3ae2787110a995d8db0135::subnet:0716-b49ef064-0f89-4fb1-8212-135b12568f04", "enabled": true, "healthy": true, "dns_server_ip": "10.10.16.8"}], "created_on": "2021-04-21T08:18:25.000Z", "modified_on": "2021-04-21T08:18:25.000Z"}'
4246
+ responses .add (responses .PUT ,
4247
+ url ,
4248
+ body = mock_response ,
4249
+ content_type = 'application/json' ,
4250
+ status = 200 )
4251
+
4252
+ # Set up parameter values
4253
+ instance_id = 'testString'
4254
+ resolver_id = 'testString'
4255
+ locations = ['9a234ede-c2b6-4c39-bc27-d39ec139ecdb' ]
4256
+ x_correlation_id = 'testString'
4257
+
4258
+ # Invoke method
4259
+ response = _service .update_cr_locations_order (
4260
+ instance_id ,
4261
+ resolver_id ,
4262
+ locations = locations ,
4263
+ x_correlation_id = x_correlation_id ,
4264
+ headers = {}
4265
+ )
4266
+
4267
+ # Check for correct operation
4268
+ assert len (responses .calls ) == 1
4269
+ assert response .status_code == 200
4270
+ # Validate body params
4271
+ req_body = json .loads (str (responses .calls [0 ].request .body , 'utf-8' ))
4272
+ assert req_body ['locations' ] == ['9a234ede-c2b6-4c39-bc27-d39ec139ecdb' ]
4273
+
4274
+
4275
+ @responses .activate
4276
+ def test_update_cr_locations_order_required_params (self ):
4277
+ """
4278
+ test_update_cr_locations_order_required_params()
4279
+ """
4280
+ # Set up mock
4281
+ url = self .preprocess_url (_base_url + '/instances/testString/custom_resolvers/testString/locations_order' )
4282
+ mock_response = '{"id": "5365b73c-ce6f-4d6f-ad9f-d9c131b26370", "name": "my-resolver", "description": "custom resolver", "enabled": false, "health": "HEALTHY", "locations": [{"id": "9a234ede-c2b6-4c39-bc27-d39ec139ecdb", "subnet_crn": "crn:v1:bluemix:public:is:us-south-1:a/01652b251c3ae2787110a995d8db0135::subnet:0716-b49ef064-0f89-4fb1-8212-135b12568f04", "enabled": true, "healthy": true, "dns_server_ip": "10.10.16.8"}], "created_on": "2021-04-21T08:18:25.000Z", "modified_on": "2021-04-21T08:18:25.000Z"}'
4283
+ responses .add (responses .PUT ,
4284
+ url ,
4285
+ body = mock_response ,
4286
+ content_type = 'application/json' ,
4287
+ status = 200 )
4288
+
4289
+ # Set up parameter values
4290
+ instance_id = 'testString'
4291
+ resolver_id = 'testString'
4292
+
4293
+ # Invoke method
4294
+ response = _service .update_cr_locations_order (
4295
+ instance_id ,
4296
+ resolver_id ,
4297
+ headers = {}
4298
+ )
4299
+
4300
+ # Check for correct operation
4301
+ assert len (responses .calls ) == 1
4302
+ assert response .status_code == 200
4303
+
4304
+
4305
+ @responses .activate
4306
+ def test_update_cr_locations_order_value_error (self ):
4307
+ """
4308
+ test_update_cr_locations_order_value_error()
4309
+ """
4310
+ # Set up mock
4311
+ url = self .preprocess_url (_base_url + '/instances/testString/custom_resolvers/testString/locations_order' )
4312
+ mock_response = '{"id": "5365b73c-ce6f-4d6f-ad9f-d9c131b26370", "name": "my-resolver", "description": "custom resolver", "enabled": false, "health": "HEALTHY", "locations": [{"id": "9a234ede-c2b6-4c39-bc27-d39ec139ecdb", "subnet_crn": "crn:v1:bluemix:public:is:us-south-1:a/01652b251c3ae2787110a995d8db0135::subnet:0716-b49ef064-0f89-4fb1-8212-135b12568f04", "enabled": true, "healthy": true, "dns_server_ip": "10.10.16.8"}], "created_on": "2021-04-21T08:18:25.000Z", "modified_on": "2021-04-21T08:18:25.000Z"}'
4313
+ responses .add (responses .PUT ,
4314
+ url ,
4315
+ body = mock_response ,
4316
+ content_type = 'application/json' ,
4317
+ status = 200 )
4318
+
4319
+ # Set up parameter values
4320
+ instance_id = 'testString'
4321
+ resolver_id = 'testString'
4322
+
4323
+ # Pass in all but one required param and check for a ValueError
4324
+ req_param_dict = {
4325
+ "instance_id" : instance_id ,
4326
+ "resolver_id" : resolver_id ,
4327
+ }
4328
+ for param in req_param_dict .keys ():
4329
+ req_copy = {key :val if key is not param else None for (key ,val ) in req_param_dict .items ()}
4330
+ with pytest .raises (ValueError ):
4331
+ _service .update_cr_locations_order (** req_copy )
4332
+
4333
+
4334
+
4224
4335
# endregion
4225
4336
##############################################################################
4226
4337
# End of Service: CustomResolvers
@@ -5271,8 +5382,8 @@ def test_custom_resolver_serialization(self):
5271
5382
custom_resolver_model_json ['enabled' ] = False
5272
5383
custom_resolver_model_json ['health' ] = 'HEALTHY'
5273
5384
custom_resolver_model_json ['locations' ] = [location_model ]
5274
- custom_resolver_model_json ['created_on' ] = "2021-04-21T08:18:25Z"
5275
- custom_resolver_model_json ['modified_on' ] = "2021-04-21T08:18:25Z"
5385
+ custom_resolver_model_json ['created_on' ] = '2015-03-14T09:26:53.123456Z'
5386
+ custom_resolver_model_json ['modified_on' ] = '2015-03-14T09:26:53.123456Z'
5276
5387
5277
5388
# Construct a model instance of CustomResolver by calling from_dict on the json representation
5278
5389
custom_resolver_model = CustomResolver .from_dict (custom_resolver_model_json )
@@ -5315,8 +5426,8 @@ def test_custom_resolver_list_serialization(self):
5315
5426
custom_resolver_model ['enabled' ] = False
5316
5427
custom_resolver_model ['health' ] = 'HEALTHY'
5317
5428
custom_resolver_model ['locations' ] = [location_model ]
5318
- custom_resolver_model ['created_on' ] = "2021-04-21T08:18:25Z"
5319
- custom_resolver_model ['modified_on' ] = "2021-04-21T08:18:25Z"
5429
+ custom_resolver_model ['created_on' ] = '2015-03-14T09:26:53.123456Z'
5430
+ custom_resolver_model ['modified_on' ] = '2015-03-14T09:26:53.123456Z'
5320
5431
5321
5432
# Construct a json representation of a CustomResolverList model
5322
5433
custom_resolver_list_model_json = {}
@@ -5419,8 +5530,8 @@ def test_forwarding_rule_serialization(self):
5419
5530
forwarding_rule_model_json ['type' ] = 'zone'
5420
5531
forwarding_rule_model_json ['match' ] = 'example.com'
5421
5532
forwarding_rule_model_json ['forward_to' ] = ['161.26.0.7' ]
5422
- forwarding_rule_model_json ['created_on' ] = "2021-04-21T08:18:25Z"
5423
- forwarding_rule_model_json ['modified_on' ] = "2021-04-21T08:18:25Z"
5533
+ forwarding_rule_model_json ['created_on' ] = '2015-03-14T09:26:53.123456Z'
5534
+ forwarding_rule_model_json ['modified_on' ] = '2015-03-14T09:26:53.123456Z'
5424
5535
5425
5536
# Construct a model instance of ForwardingRule by calling from_dict on the json representation
5426
5537
forwarding_rule_model = ForwardingRule .from_dict (forwarding_rule_model_json )
@@ -5455,8 +5566,8 @@ def test_forwarding_rule_list_serialization(self):
5455
5566
forwarding_rule_model ['type' ] = 'zone'
5456
5567
forwarding_rule_model ['match' ] = 'example.com'
5457
5568
forwarding_rule_model ['forward_to' ] = ['161.26.0.7' ]
5458
- forwarding_rule_model ['created_on' ] = "2021-04-21T08:18:25Z"
5459
- forwarding_rule_model ['modified_on' ] = "2021-04-21T08:18:25Z"
5569
+ forwarding_rule_model ['created_on' ] = '2015-03-14T09:26:53.123456Z'
5570
+ forwarding_rule_model ['modified_on' ] = '2015-03-14T09:26:53.123456Z'
5460
5571
5461
5572
# Construct a json representation of a ForwardingRuleList model
5462
5573
forwarding_rule_list_model_json = {}
0 commit comments