From 7bac88470e702dca8e41b3ae5b4368d392cf68cf Mon Sep 17 00:00:00 2001 From: Sandeep S Date: Thu, 7 Jul 2022 12:16:35 +0530 Subject: [PATCH] feat : Add support for secondary zone Signed-off-by: Sandeep S --- ibm_cloud_networking_services/dns_svcs_v1.py | 548 +++++++++++++ test/integration/test_dns_svcs_v1.py | 43 ++ test/unit/test_dns_svcs_v1.py | 771 +++++++++++++++++++ 3 files changed, 1362 insertions(+) diff --git a/ibm_cloud_networking_services/dns_svcs_v1.py b/ibm_cloud_networking_services/dns_svcs_v1.py index 9c31d43..34b214e 100644 --- a/ibm_cloud_networking_services/dns_svcs_v1.py +++ b/ibm_cloud_networking_services/dns_svcs_v1.py @@ -2848,6 +2848,309 @@ def update_forwarding_rule(self, response = self.send(request, **kwargs) return response + ######################### + # Secondary Zones + ######################### + + + def create_secondary_zone(self, + instance_id: str, + resolver_id: str, + *, + zone: str = None, + transfer_from: List[str] = None, + description: str = None, + enabled: bool = None, + x_correlation_id: str = None, + **kwargs + ) -> DetailedResponse: + """ + Create a secondary zone. + + Create a secondary zone for the custom resolver. + + :param str instance_id: The unique identifier of a service instance. + :param str resolver_id: The unique identifier of a custom resolver. + :param str zone: (optional) zone name. + :param List[str] transfer_from: (optional) The addresses of DNS servers + where the secondary zone data should be transferred from. + :param str description: (optional) Descriptive text of the secondary zone. + :param bool enabled: (optional) Enable/Disable the secondary zone. + :param str x_correlation_id: (optional) Uniquely identifying a request. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `SecondaryZone` object + """ + + if instance_id is None: + raise ValueError('instance_id must be provided') + if resolver_id is None: + raise ValueError('resolver_id must be provided') + headers = { + 'X-Correlation-ID': x_correlation_id + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_secondary_zone') + headers.update(sdk_headers) + + data = { + 'zone': zone, + 'transfer_from': transfer_from, + 'description': description, + 'enabled': enabled + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'resolver_id'] + path_param_values = self.encode_path_vars(instance_id, resolver_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/custom_resolvers/{resolver_id}/secondary_zones'.format(**path_param_dict) + request = self.prepare_request(method='POST', + url=url, + headers=headers, + data=data) + + response = self.send(request, **kwargs) + return response + + + def list_secondary_zones(self, + instance_id: str, + resolver_id: str, + *, + x_correlation_id: str = None, + offset: int = None, + limit: int = None, + **kwargs + ) -> DetailedResponse: + """ + List secondary zones. + + List secondary zones for the custom resolver. + + :param str instance_id: The unique identifier of a service instance. + :param str resolver_id: The unique identifier of a custom resolver. + :param str x_correlation_id: (optional) Uniquely identifying a request. + :param int offset: (optional) Specify how many resources to skip over, the + default value is 0. + :param int limit: (optional) Specify maximum resources might be returned. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `SecondaryZoneList` object + """ + + if instance_id is None: + raise ValueError('instance_id must be provided') + if resolver_id is None: + raise ValueError('resolver_id must be provided') + headers = { + 'X-Correlation-ID': x_correlation_id + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_secondary_zones') + headers.update(sdk_headers) + + params = { + 'offset': offset, + 'limit': limit + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'resolver_id'] + path_param_values = self.encode_path_vars(instance_id, resolver_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/custom_resolvers/{resolver_id}/secondary_zones'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_secondary_zone(self, + instance_id: str, + resolver_id: str, + secondary_zone_id: str, + *, + x_correlation_id: str = None, + **kwargs + ) -> DetailedResponse: + """ + Get a secondary zone. + + Get details of a secondary zone for the custom resolver. + + :param str instance_id: The unique identifier of a service instance. + :param str resolver_id: The unique identifier of a custom resolver. + :param str secondary_zone_id: The unique identifier of a secondary zone. + :param str x_correlation_id: (optional) Uniquely identifying a request. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `SecondaryZone` object + """ + + if instance_id is None: + raise ValueError('instance_id must be provided') + if resolver_id is None: + raise ValueError('resolver_id must be provided') + if secondary_zone_id is None: + raise ValueError('secondary_zone_id must be provided') + headers = { + 'X-Correlation-ID': x_correlation_id + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_secondary_zone') + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'resolver_id', 'secondary_zone_id'] + path_param_values = self.encode_path_vars(instance_id, resolver_id, secondary_zone_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/custom_resolvers/{resolver_id}/secondary_zones/{secondary_zone_id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers) + + response = self.send(request, **kwargs) + return response + + + def update_secondary_zone(self, + instance_id: str, + resolver_id: str, + secondary_zone_id: str, + *, + description: str = None, + enabled: bool = None, + transfer_from: List[str] = None, + x_correlation_id: str = None, + **kwargs + ) -> DetailedResponse: + """ + Update a secondary zone. + + Update a secondary zone for the custom resolver. + + :param str instance_id: The unique identifier of a service instance. + :param str resolver_id: The unique identifier of a custom resolver. + :param str secondary_zone_id: The unique identifier of a secondary zone. + :param str description: (optional) Descriptive text of the secondary zone. + :param bool enabled: (optional) Enable/Disable the secondary zone. + :param List[str] transfer_from: (optional) The addresses of DNS servers + where the secondary zone data should be transferred from. + :param str x_correlation_id: (optional) Uniquely identifying a request. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `SecondaryZone` object + """ + + if instance_id is None: + raise ValueError('instance_id must be provided') + if resolver_id is None: + raise ValueError('resolver_id must be provided') + if secondary_zone_id is None: + raise ValueError('secondary_zone_id must be provided') + headers = { + 'X-Correlation-ID': x_correlation_id + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_secondary_zone') + headers.update(sdk_headers) + + data = { + 'description': description, + 'enabled': enabled, + 'transfer_from': transfer_from + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'resolver_id', 'secondary_zone_id'] + path_param_values = self.encode_path_vars(instance_id, resolver_id, secondary_zone_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/custom_resolvers/{resolver_id}/secondary_zones/{secondary_zone_id}'.format(**path_param_dict) + request = self.prepare_request(method='PATCH', + url=url, + headers=headers, + data=data) + + response = self.send(request, **kwargs) + return response + + + def delete_secondary_zone(self, + instance_id: str, + resolver_id: str, + secondary_zone_id: str, + *, + x_correlation_id: str = None, + **kwargs + ) -> DetailedResponse: + """ + Delete a secondary zone. + + Delete a secondary zone for the custom resolver. + + :param str instance_id: The unique identifier of a service instance. + :param str resolver_id: The unique identifier of a custom resolver. + :param str secondary_zone_id: The unique identifier of a secondary zone. + :param str x_correlation_id: (optional) Uniquely identifying a request. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if instance_id is None: + raise ValueError('instance_id must be provided') + if resolver_id is None: + raise ValueError('resolver_id must be provided') + if secondary_zone_id is None: + raise ValueError('secondary_zone_id must be provided') + headers = { + 'X-Correlation-ID': x_correlation_id + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_secondary_zone') + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + + path_param_keys = ['instance_id', 'resolver_id', 'secondary_zone_id'] + path_param_values = self.encode_path_vars(instance_id, resolver_id, secondary_zone_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/custom_resolvers/{resolver_id}/secondary_zones/{secondary_zone_id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers) + + response = self.send(request, **kwargs) + return response + ######################### # Linked Zones ######################### @@ -7368,6 +7671,251 @@ class TypeEnum(str, Enum): PTR = 'PTR' +class SecondaryZone(): + """ + Secondary zone details. + + :attr str id: Identifier of the secondary zone. + :attr str description: (optional) Descriptive text of the secondary zone. + :attr str zone: zone name. + :attr bool enabled: Enable/Disable the secondary zone. + :attr List[str] transfer_from: The addresses of DNS servers where the secondary + zone data should be transferred from. + :attr str created_on: (optional) The time when a secondary zone is created. + :attr str modified_on: (optional) The recent time when a secondary zone is + modified. + """ + + def __init__(self, + id: str, + zone: str, + enabled: bool, + transfer_from: List[str], + *, + description: str = None, + created_on: str = None, + modified_on: str = None) -> None: + """ + Initialize a SecondaryZone object. + + :param str id: Identifier of the secondary zone. + :param str zone: zone name. + :param bool enabled: Enable/Disable the secondary zone. + :param List[str] transfer_from: The addresses of DNS servers where the + secondary zone data should be transferred from. + :param str description: (optional) Descriptive text of the secondary zone. + :param str created_on: (optional) The time when a secondary zone is + created. + :param str modified_on: (optional) The recent time when a secondary zone is + modified. + """ + self.id = id + self.description = description + self.zone = zone + self.enabled = enabled + self.transfer_from = transfer_from + self.created_on = created_on + self.modified_on = modified_on + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecondaryZone': + """Initialize a SecondaryZone object from a json dictionary.""" + args = {} + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in SecondaryZone JSON') + if 'description' in _dict: + args['description'] = _dict.get('description') + if 'zone' in _dict: + args['zone'] = _dict.get('zone') + else: + raise ValueError('Required property \'zone\' not present in SecondaryZone JSON') + if 'enabled' in _dict: + args['enabled'] = _dict.get('enabled') + else: + raise ValueError('Required property \'enabled\' not present in SecondaryZone JSON') + if 'transfer_from' in _dict: + args['transfer_from'] = _dict.get('transfer_from') + else: + raise ValueError('Required property \'transfer_from\' not present in SecondaryZone JSON') + if 'created_on' in _dict: + args['created_on'] = _dict.get('created_on') + if 'modified_on' in _dict: + args['modified_on'] = _dict.get('modified_on') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecondaryZone object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone + if hasattr(self, 'enabled') and self.enabled is not None: + _dict['enabled'] = self.enabled + if hasattr(self, 'transfer_from') and self.transfer_from is not None: + _dict['transfer_from'] = self.transfer_from + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = self.created_on + if hasattr(self, 'modified_on') and self.modified_on is not None: + _dict['modified_on'] = self.modified_on + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this SecondaryZone object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecondaryZone') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecondaryZone') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class SecondaryZoneList(): + """ + List of secondary zones. + + :attr List[SecondaryZone] secondary_zones: Secondary zones. + :attr int offset: The number of resources to skip over. + :attr int limit: The maximum number of resources might be returned. + :attr int count: The number of resources are returned. + :attr int total_count: Total number of resources. + :attr PaginationRef first: (optional) href. + :attr PaginationRef last: (optional) href. + :attr PaginationRef previous: (optional) href. + :attr PaginationRef next: (optional) href. + """ + + def __init__(self, + secondary_zones: List['SecondaryZone'], + offset: int, + limit: int, + count: int, + total_count: int, + *, + first: 'PaginationRef' = None, + last: 'PaginationRef' = None, + previous: 'PaginationRef' = None, + next: 'PaginationRef' = None) -> None: + """ + Initialize a SecondaryZoneList object. + + :param List[SecondaryZone] secondary_zones: Secondary zones. + :param int offset: The number of resources to skip over. + :param int limit: The maximum number of resources might be returned. + :param int count: The number of resources are returned. + :param int total_count: Total number of resources. + :param PaginationRef first: (optional) href. + :param PaginationRef last: (optional) href. + :param PaginationRef previous: (optional) href. + :param PaginationRef next: (optional) href. + """ + self.secondary_zones = secondary_zones + self.offset = offset + self.limit = limit + self.count = count + self.total_count = total_count + self.first = first + self.last = last + self.previous = previous + self.next = next + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecondaryZoneList': + """Initialize a SecondaryZoneList object from a json dictionary.""" + args = {} + if 'secondary_zones' in _dict: + args['secondary_zones'] = [SecondaryZone.from_dict(x) for x in _dict.get('secondary_zones')] + else: + raise ValueError('Required property \'secondary_zones\' not present in SecondaryZoneList JSON') + if 'offset' in _dict: + args['offset'] = _dict.get('offset') + else: + raise ValueError('Required property \'offset\' not present in SecondaryZoneList JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in SecondaryZoneList JSON') + if 'count' in _dict: + args['count'] = _dict.get('count') + else: + raise ValueError('Required property \'count\' not present in SecondaryZoneList JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in SecondaryZoneList JSON') + if 'first' in _dict: + args['first'] = PaginationRef.from_dict(_dict.get('first')) + if 'last' in _dict: + args['last'] = PaginationRef.from_dict(_dict.get('last')) + if 'previous' in _dict: + args['previous'] = PaginationRef.from_dict(_dict.get('previous')) + if 'next' in _dict: + args['next'] = PaginationRef.from_dict(_dict.get('next')) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecondaryZoneList object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'secondary_zones') and self.secondary_zones is not None: + _dict['secondary_zones'] = [x.to_dict() for x in self.secondary_zones] + if hasattr(self, 'offset') and self.offset is not None: + _dict['offset'] = self.offset + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'count') and self.count is not None: + _dict['count'] = self.count + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'last') and self.last is not None: + _dict['last'] = self.last.to_dict() + if hasattr(self, 'previous') and self.previous is not None: + _dict['previous'] = self.previous.to_dict() + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this SecondaryZoneList object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecondaryZoneList') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecondaryZoneList') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + class ResourceRecordInputRdataRdataARecord(ResourceRecordInputRdata): """ The content of type-A resource record. diff --git a/test/integration/test_dns_svcs_v1.py b/test/integration/test_dns_svcs_v1.py index abed4c4..cc33bd0 100644 --- a/test/integration/test_dns_svcs_v1.py +++ b/test/integration/test_dns_svcs_v1.py @@ -1198,6 +1198,49 @@ def test_1_dns_customresolvers(self): assert resp is not None assert resp.status_code == 200 + """ create,get,update,list Secondary Zones """ + # Create secondary zones + description = "Secondary zone" + zone = "example.com" + enabled = False + transfer_from = ["10.0.0.7"] + resp = self.cr.create_secondary_zone(instance_id=self.instance_id, resolver_id=resolver_id, + description=description, zone=zone, enabled=enabled, transfer_from=transfer_from) + secondary_zone_id = resp.get_result().get("id") + assert resp is not None + assert resp.status_code == 200 + + # List Secondary zones + offset = 0 + limit = 200 + resp = self.cr.list_secondary_zones(instance_id=self.instance_id, resolver_id=resolver_id, + offset=offset, limit=limit) + assert resp is not None + assert resp.status_code == 200 + + # Get Secondary zones + x_correlation_id = "abc123" + resp = self.cr.get_secondary_zone(instance_id=self.instance_id, resolver_id=resolver_id, + secondary_zone_id=secondary_zone_id, x_correlation_id=x_correlation_id) + assert resp is not None + assert resp.status_code == 200 + + # Update Secondary zones + x_correlation_id = "abc123" + description = "update Secondary zone" + enabled = False + transfer_from = ["10.0.0.5"] + resp = self.cr.update_secondary_zone(instance_id=self.instance_id, resolver_id=resolver_id, secondary_zone_id=secondary_zone_id, x_correlation_id=x_correlation_id, description=description, enabled=enabled, transfer_from=transfer_from ) + assert resp is not None + assert resp.status_code == 200 + + # Delete Secondary zones + x_correlation_id = "abc123" + resp = self.cr.delete_secondary_zone(instance_id=self.instance_id, resolver_id=resolver_id, + secondary_zone_id=secondary_zone_id, x_correlation_id=x_correlation_id ) + assert resp is not None + assert resp.status_code == 204 + """ Delete Custom Resolver, Locations, Forwarding rules """ # Delete Forwarding rules resp = self.cr.delete_forwarding_rule(instance_id=self.instance_id, resolver_id=resolver_id, rule_id=rule_id) diff --git a/test/unit/test_dns_svcs_v1.py b/test/unit/test_dns_svcs_v1.py index c7508de..39faa1b 100644 --- a/test/unit/test_dns_svcs_v1.py +++ b/test/unit/test_dns_svcs_v1.py @@ -6220,6 +6220,691 @@ def test_update_forwarding_rule_value_error_with_retries(self): # End of Service: ForwardingRules ############################################################################## +############################################################################## +# Start of Service: SecondaryZones +############################################################################## +# region + +class TestNewInstance(): + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = DnsSvcsV1.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, DnsSvcsV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = DnsSvcsV1.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + +class TestCreateSecondaryZone(): + """ + Test Class for create_secondary_zone + """ + + @responses.activate + def test_create_secondary_zone_all_params(self): + """ + create_secondary_zone() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + zone = 'example.com' + transfer_from = ['10.0.0.7'] + description = 'secondary zone' + enabled = False + x_correlation_id = 'testString' + + # Invoke method + response = _service.create_secondary_zone( + instance_id, + resolver_id, + zone=zone, + transfer_from=transfer_from, + description=description, + enabled=enabled, + x_correlation_id=x_correlation_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['zone'] == 'example.com' + assert req_body['transfer_from'] == ['10.0.0.7'] + assert req_body['description'] == 'secondary zone' + assert req_body['enabled'] == False + + def test_create_secondary_zone_all_params_with_retries(self): + # Enable retries and run test_create_secondary_zone_all_params. + _service.enable_retries() + self.test_create_secondary_zone_all_params() + + # Disable retries and run test_create_secondary_zone_all_params. + _service.disable_retries() + self.test_create_secondary_zone_all_params() + + @responses.activate + def test_create_secondary_zone_required_params(self): + """ + test_create_secondary_zone_required_params() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + + # Invoke method + response = _service.create_secondary_zone( + instance_id, + resolver_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_create_secondary_zone_required_params_with_retries(self): + # Enable retries and run test_create_secondary_zone_required_params. + _service.enable_retries() + self.test_create_secondary_zone_required_params() + + # Disable retries and run test_create_secondary_zone_required_params. + _service.disable_retries() + self.test_create_secondary_zone_required_params() + + @responses.activate + def test_create_secondary_zone_value_error(self): + """ + test_create_secondary_zone_value_error() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "resolver_id": resolver_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_secondary_zone(**req_copy) + + + def test_create_secondary_zone_value_error_with_retries(self): + # Enable retries and run test_create_secondary_zone_value_error. + _service.enable_retries() + self.test_create_secondary_zone_value_error() + + # Disable retries and run test_create_secondary_zone_value_error. + _service.disable_retries() + self.test_create_secondary_zone_value_error() + +class TestListSecondaryZones(): + """ + Test Class for list_secondary_zones + """ + + @responses.activate + def test_list_secondary_zones_all_params(self): + """ + list_secondary_zones() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones') + mock_response = '{"secondary_zones": [{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}], "offset": 0, "limit": 200, "count": 1, "total_count": 1, "first": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "last": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "previous": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "next": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + x_correlation_id = 'testString' + offset = 38 + limit = 200 + + # Invoke method + response = _service.list_secondary_zones( + instance_id, + resolver_id, + x_correlation_id=x_correlation_id, + offset=offset, + limit=limit, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'offset={}'.format(offset) in query_string + assert 'limit={}'.format(limit) in query_string + + def test_list_secondary_zones_all_params_with_retries(self): + # Enable retries and run test_list_secondary_zones_all_params. + _service.enable_retries() + self.test_list_secondary_zones_all_params() + + # Disable retries and run test_list_secondary_zones_all_params. + _service.disable_retries() + self.test_list_secondary_zones_all_params() + + @responses.activate + def test_list_secondary_zones_required_params(self): + """ + test_list_secondary_zones_required_params() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones') + mock_response = '{"secondary_zones": [{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}], "offset": 0, "limit": 200, "count": 1, "total_count": 1, "first": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "last": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "previous": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "next": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + + # Invoke method + response = _service.list_secondary_zones( + instance_id, + resolver_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_secondary_zones_required_params_with_retries(self): + # Enable retries and run test_list_secondary_zones_required_params. + _service.enable_retries() + self.test_list_secondary_zones_required_params() + + # Disable retries and run test_list_secondary_zones_required_params. + _service.disable_retries() + self.test_list_secondary_zones_required_params() + + @responses.activate + def test_list_secondary_zones_value_error(self): + """ + test_list_secondary_zones_value_error() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones') + mock_response = '{"secondary_zones": [{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}], "offset": 0, "limit": 200, "count": 1, "total_count": 1, "first": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "last": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "previous": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}, "next": {"href": "https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200"}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "resolver_id": resolver_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_secondary_zones(**req_copy) + + + def test_list_secondary_zones_value_error_with_retries(self): + # Enable retries and run test_list_secondary_zones_value_error. + _service.enable_retries() + self.test_list_secondary_zones_value_error() + + # Disable retries and run test_list_secondary_zones_value_error. + _service.disable_retries() + self.test_list_secondary_zones_value_error() + +class TestGetSecondaryZone(): + """ + Test Class for get_secondary_zone + """ + + @responses.activate + def test_get_secondary_zone_all_params(self): + """ + get_secondary_zone() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + x_correlation_id = 'testString' + + # Invoke method + response = _service.get_secondary_zone( + instance_id, + resolver_id, + secondary_zone_id, + x_correlation_id=x_correlation_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_secondary_zone_all_params_with_retries(self): + # Enable retries and run test_get_secondary_zone_all_params. + _service.enable_retries() + self.test_get_secondary_zone_all_params() + + # Disable retries and run test_get_secondary_zone_all_params. + _service.disable_retries() + self.test_get_secondary_zone_all_params() + + @responses.activate + def test_get_secondary_zone_required_params(self): + """ + test_get_secondary_zone_required_params() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + + # Invoke method + response = _service.get_secondary_zone( + instance_id, + resolver_id, + secondary_zone_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_secondary_zone_required_params_with_retries(self): + # Enable retries and run test_get_secondary_zone_required_params. + _service.enable_retries() + self.test_get_secondary_zone_required_params() + + # Disable retries and run test_get_secondary_zone_required_params. + _service.disable_retries() + self.test_get_secondary_zone_required_params() + + @responses.activate + def test_get_secondary_zone_value_error(self): + """ + test_get_secondary_zone_value_error() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "resolver_id": resolver_id, + "secondary_zone_id": secondary_zone_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_secondary_zone(**req_copy) + + + def test_get_secondary_zone_value_error_with_retries(self): + # Enable retries and run test_get_secondary_zone_value_error. + _service.enable_retries() + self.test_get_secondary_zone_value_error() + + # Disable retries and run test_get_secondary_zone_value_error. + _service.disable_retries() + self.test_get_secondary_zone_value_error() + +class TestUpdateSecondaryZone(): + """ + Test Class for update_secondary_zone + """ + + @responses.activate + def test_update_secondary_zone_all_params(self): + """ + update_secondary_zone() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + description = 'secondary zone' + enabled = False + transfer_from = ['10.0.0.7'] + x_correlation_id = 'testString' + + # Invoke method + response = _service.update_secondary_zone( + instance_id, + resolver_id, + secondary_zone_id, + description=description, + enabled=enabled, + transfer_from=transfer_from, + x_correlation_id=x_correlation_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['description'] == 'secondary zone' + assert req_body['enabled'] == False + assert req_body['transfer_from'] == ['10.0.0.7'] + + def test_update_secondary_zone_all_params_with_retries(self): + # Enable retries and run test_update_secondary_zone_all_params. + _service.enable_retries() + self.test_update_secondary_zone_all_params() + + # Disable retries and run test_update_secondary_zone_all_params. + _service.disable_retries() + self.test_update_secondary_zone_all_params() + + @responses.activate + def test_update_secondary_zone_required_params(self): + """ + test_update_secondary_zone_required_params() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + + # Invoke method + response = _service.update_secondary_zone( + instance_id, + resolver_id, + secondary_zone_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_update_secondary_zone_required_params_with_retries(self): + # Enable retries and run test_update_secondary_zone_required_params. + _service.enable_retries() + self.test_update_secondary_zone_required_params() + + # Disable retries and run test_update_secondary_zone_required_params. + _service.disable_retries() + self.test_update_secondary_zone_required_params() + + @responses.activate + def test_update_secondary_zone_value_error(self): + """ + test_update_secondary_zone_value_error() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + mock_response = '{"id": "f97ef698-d5fa-4f91-bc5a-33f17d143b7d", "description": "secondary zone", "zone": "example.com", "enabled": false, "transfer_from": ["10.0.0.7:53"], "created_on": "2022-03-16T08:18:25Z", "modified_on": "2022-03-16T08:18:25Z"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "resolver_id": resolver_id, + "secondary_zone_id": secondary_zone_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_secondary_zone(**req_copy) + + + def test_update_secondary_zone_value_error_with_retries(self): + # Enable retries and run test_update_secondary_zone_value_error. + _service.enable_retries() + self.test_update_secondary_zone_value_error() + + # Disable retries and run test_update_secondary_zone_value_error. + _service.disable_retries() + self.test_update_secondary_zone_value_error() + +class TestDeleteSecondaryZone(): + """ + Test Class for delete_secondary_zone + """ + + @responses.activate + def test_delete_secondary_zone_all_params(self): + """ + delete_secondary_zone() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + x_correlation_id = 'testString' + + # Invoke method + response = _service.delete_secondary_zone( + instance_id, + resolver_id, + secondary_zone_id, + x_correlation_id=x_correlation_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_secondary_zone_all_params_with_retries(self): + # Enable retries and run test_delete_secondary_zone_all_params. + _service.enable_retries() + self.test_delete_secondary_zone_all_params() + + # Disable retries and run test_delete_secondary_zone_all_params. + _service.disable_retries() + self.test_delete_secondary_zone_all_params() + + @responses.activate + def test_delete_secondary_zone_required_params(self): + """ + test_delete_secondary_zone_required_params() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + + # Invoke method + response = _service.delete_secondary_zone( + instance_id, + resolver_id, + secondary_zone_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_secondary_zone_required_params_with_retries(self): + # Enable retries and run test_delete_secondary_zone_required_params. + _service.enable_retries() + self.test_delete_secondary_zone_required_params() + + # Disable retries and run test_delete_secondary_zone_required_params. + _service.disable_retries() + self.test_delete_secondary_zone_required_params() + + @responses.activate + def test_delete_secondary_zone_value_error(self): + """ + test_delete_secondary_zone_value_error() + """ + # Set up mock + url = preprocess_url('/instances/testString/custom_resolvers/testString/secondary_zones/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + instance_id = 'testString' + resolver_id = 'testString' + secondary_zone_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "resolver_id": resolver_id, + "secondary_zone_id": secondary_zone_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_secondary_zone(**req_copy) + + + def test_delete_secondary_zone_value_error_with_retries(self): + # Enable retries and run test_delete_secondary_zone_value_error. + _service.enable_retries() + self.test_delete_secondary_zone_value_error() + + # Disable retries and run test_delete_secondary_zone_value_error. + _service.disable_retries() + self.test_delete_secondary_zone_value_error() + +# endregion +############################################################################## +# End of Service: SecondaryZones +############################################################################## + ############################################################################## # Start of Service: LinkedZones ############################################################################## @@ -9354,6 +10039,92 @@ def test_resource_record_serialization(self): resource_record_model_json2 = resource_record_model.to_dict() assert resource_record_model_json2 == resource_record_model_json +class TestModel_SecondaryZone(): + """ + Test Class for SecondaryZone + """ + + def test_secondary_zone_serialization(self): + """ + Test serialization/deserialization for SecondaryZone + """ + + # Construct a json representation of a SecondaryZone model + secondary_zone_model_json = {} + secondary_zone_model_json['id'] = 'f97ef698-d5fa-4f91-bc5a-33f17d143b7d' + secondary_zone_model_json['description'] = 'secondary zone' + secondary_zone_model_json['zone'] = 'example.com' + secondary_zone_model_json['enabled'] = False + secondary_zone_model_json['transfer_from'] = ['10.0.0.7:53'] + secondary_zone_model_json['created_on'] = '2022-03-16T08:18:25Z' + secondary_zone_model_json['modified_on'] = '2022-03-16T08:18:25Z' + + # Construct a model instance of SecondaryZone by calling from_dict on the json representation + secondary_zone_model = SecondaryZone.from_dict(secondary_zone_model_json) + assert secondary_zone_model != False + + # Construct a model instance of SecondaryZone by calling from_dict on the json representation + secondary_zone_model_dict = SecondaryZone.from_dict(secondary_zone_model_json).__dict__ + secondary_zone_model2 = SecondaryZone(**secondary_zone_model_dict) + + # Verify the model instances are equivalent + assert secondary_zone_model == secondary_zone_model2 + + # Convert model instance back to dict and verify no loss of data + secondary_zone_model_json2 = secondary_zone_model.to_dict() + assert secondary_zone_model_json2 == secondary_zone_model_json + +class TestModel_SecondaryZoneList(): + """ + Test Class for SecondaryZoneList + """ + + def test_secondary_zone_list_serialization(self): + """ + Test serialization/deserialization for SecondaryZoneList + """ + + # Construct dict forms of any model objects needed in order to build this model. + + secondary_zone_model = {} # SecondaryZone + secondary_zone_model['id'] = 'f97ef698-d5fa-4f91-bc5a-33f17d143b7d' + secondary_zone_model['description'] = 'secondary zone' + secondary_zone_model['zone'] = 'example.com' + secondary_zone_model['enabled'] = False + secondary_zone_model['transfer_from'] = ['10.0.0.7:53'] + secondary_zone_model['created_on'] = '2022-03-16T08:18:25Z' + secondary_zone_model['modified_on'] = '2022-03-16T08:18:25Z' + + pagination_ref_model = {} # PaginationRef + pagination_ref_model['href'] = 'https://api.dns-svcs.cloud.ibm.com/v1/instances/434f6c3e-6014-4124-a61d-2e910bca19b1/dnszones?offset=0&limit=200' + + # Construct a json representation of a SecondaryZoneList model + secondary_zone_list_model_json = {} + secondary_zone_list_model_json['secondary_zones'] = [secondary_zone_model] + secondary_zone_list_model_json['offset'] = 0 + secondary_zone_list_model_json['limit'] = 200 + secondary_zone_list_model_json['count'] = 1 + secondary_zone_list_model_json['total_count'] = 1 + secondary_zone_list_model_json['first'] = pagination_ref_model + secondary_zone_list_model_json['last'] = pagination_ref_model + secondary_zone_list_model_json['previous'] = pagination_ref_model + secondary_zone_list_model_json['next'] = pagination_ref_model + + # Construct a model instance of SecondaryZoneList by calling from_dict on the json representation + secondary_zone_list_model = SecondaryZoneList.from_dict(secondary_zone_list_model_json) + assert secondary_zone_list_model != False + + # Construct a model instance of SecondaryZoneList by calling from_dict on the json representation + secondary_zone_list_model_dict = SecondaryZoneList.from_dict(secondary_zone_list_model_json).__dict__ + secondary_zone_list_model2 = SecondaryZoneList(**secondary_zone_list_model_dict) + + # Verify the model instances are equivalent + assert secondary_zone_list_model == secondary_zone_list_model2 + + # Convert model instance back to dict and verify no loss of data + secondary_zone_list_model_json2 = secondary_zone_list_model.to_dict() + assert secondary_zone_list_model_json2 == secondary_zone_list_model_json + class TestModel_ResourceRecordInputRdataRdataARecord(): """ Test Class for ResourceRecordInputRdataRdataARecord