diff --git a/ibmcloudant/cloudant_v1.py b/ibmcloudant/cloudant_v1.py index 6ac8fbd9..715a15c2 100644 --- a/ibmcloudant/cloudant_v1.py +++ b/ibmcloudant/cloudant_v1.py @@ -121,77 +121,81 @@ def get_server_information( response = self.send(request, **kwargs) return response - def get_uuids( + def get_capacity_throughput_information( self, - *, - count: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ - Retrieve one or more UUIDs. + Retrieve provisioned throughput capacity information. - Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The - response is a JSON object that provides a list of UUIDs. - **Tip:** The authentication for this endpoint is only enforced when using IAM. + View the amount of provisioned throughput capacity that is allocated to an IBM + Cloudant instance and what is the target provisioned throughput capacity. - :param int count: (optional) Query parameter to specify the number of UUIDs - to return. :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 `UuidsResult` object + :rtype: DetailedResponse with `dict` result representing a `CapacityThroughputInformation` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_uuids', + operation_id='get_capacity_throughput_information', ) headers.update(sdk_headers) - params = { - 'count': count, - } - if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_uuids' + url = '/_api/v2/user/capacity/throughput' request = self.prepare_request( method='GET', url=url, headers=headers, - params=params, ) response = self.send(request, **kwargs) return response - def get_capacity_throughput_information( + def put_capacity_throughput_configuration( self, + blocks: int, **kwargs, ) -> DetailedResponse: """ - Retrieve provisioned throughput capacity information. + Update the target provisioned throughput capacity. - View the amount of provisioned throughput capacity that is allocated to an IBM - Cloudant instance and what is the target provisioned throughput capacity. + Sets the target provisioned throughput capacity for an IBM Cloudant instance. When + target capacity is changed, the current capacity asynchronously changes to meet + the target capacity. + :param int blocks: A number of blocks of throughput units. A block consists + of 100 reads/sec, 50 writes/sec, and 5 global queries/sec of provisioned + throughput capacity. Not available for some plans. :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 `CapacityThroughputInformation` object """ + if blocks is None: + raise ValueError('blocks must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_capacity_throughput_information', + operation_id='put_capacity_throughput_configuration', ) headers.update(sdk_headers) + data = { + 'blocks': blocks, + } + 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')) del kwargs['headers'] @@ -199,62 +203,58 @@ def get_capacity_throughput_information( url = '/_api/v2/user/capacity/throughput' request = self.prepare_request( - method='GET', + method='PUT', url=url, headers=headers, + data=data, ) response = self.send(request, **kwargs) return response - def put_capacity_throughput_configuration( + def get_uuids( self, - blocks: int, + *, + count: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ - Update the target provisioned throughput capacity. + Retrieve one or more UUIDs. - Sets the target provisioned throughput capacity for an IBM Cloudant instance. When - target capacity is changed, the current capacity asynchronously changes to meet - the target capacity. + Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The + response is a JSON object that provides a list of UUIDs. + **Tip:** The authentication for this endpoint is only enforced when using IAM. - :param int blocks: A number of blocks of throughput units. A block consists - of 100 reads/sec, 50 writes/sec, and 5 global queries/sec of provisioned - throughput capacity. Not available for some plans. + :param int count: (optional) Query parameter to specify the number of UUIDs + to return. :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 `CapacityThroughputInformation` object + :rtype: DetailedResponse with `dict` result representing a `UuidsResult` object """ - if blocks is None: - raise ValueError('blocks must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='put_capacity_throughput_configuration', + operation_id='get_uuids', ) headers.update(sdk_headers) - data = { - 'blocks': blocks, + params = { + 'count': count, } - 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')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_api/v2/user/capacity/throughput' + url = '/_uuids' request = self.prepare_request( - method='PUT', + method='GET', url=url, headers=headers, - data=data, + params=params, ) response = self.send(request, **kwargs) @@ -5887,12 +5887,11 @@ def post_search( relevance. This field can have the same values as the sort field, so single fields and arrays of fields are supported. This option is only available when making global queries. - :param dict ranges: (optional) This field defines ranges for faceted, - numeric search fields. The value is a JSON object where the fields names - are faceted numeric search fields, and the values of the fields are JSON - objects. The field names of the JSON objects are names for ranges. The - values are strings that describe the range, for example "[0 TO 10]". This - option is only available when making global queries. + :param dict ranges: (optional) Object mapping faceted, numeric search field + names to the required ranges. Each key is a field name and each value is + another object defining the ranges by mapping range name keys to string + values describing the numeric ranges, for example "[0 TO 10]". This option + is only available when making global queries. :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 `SearchResult` object @@ -6057,12 +6056,11 @@ def post_search_as_stream( relevance. This field can have the same values as the sort field, so single fields and arrays of fields are supported. This option is only available when making global queries. - :param dict ranges: (optional) This field defines ranges for faceted, - numeric search fields. The value is a JSON object where the fields names - are faceted numeric search fields, and the values of the fields are JSON - objects. The field names of the JSON objects are names for ranges. The - values are strings that describe the range, for example "[0 TO 10]". This - option is only available when making global queries. + :param dict ranges: (optional) Object mapping faceted, numeric search field + names to the required ranges. Each key is a field name and each value is + another object defining the ranges by mapping range name keys to string + values describing the numeric ranges, for example "[0 TO 10]". This option + is only available when making global queries. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `BinaryIO` result @@ -6193,7 +6191,7 @@ def head_replication_document( **kwargs, ) -> DetailedResponse: """ - Retrieve the HTTP headers for a replication document. + Retrieve the HTTP headers for a persistent replication. Retrieves the HTTP headers containing minimal amount of information about the specified replication document from the `_replicator` database. The method @@ -6327,6 +6325,65 @@ def head_scheduler_job( response = self.send(request, **kwargs) return response + def post_replicator( + self, + replication_document: 'ReplicationDocument', + *, + batch: Optional[str] = None, + **kwargs, + ) -> DetailedResponse: + """ + Create a persistent replication with a generated ID. + + Creates or modifies a document in the `_replicator` database to start a new + replication or to edit an existing replication. + + :param ReplicationDocument replication_document: HTTP request body for + replication operations. + :param str batch: (optional) Query parameter to specify whether to store in + batch mode. The server will respond with a HTTP 202 Accepted response code + immediately. + :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 `DocumentResult` object + """ + + if replication_document is None: + raise ValueError('replication_document must be provided') + if isinstance(replication_document, ReplicationDocument): + replication_document = convert_model(replication_document) + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='post_replicator', + ) + headers.update(sdk_headers) + + params = { + 'batch': batch, + } + + data = json.dumps(replication_document) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + url = '/_replicator' + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + params=params, + data=data, + ) + + response = self.send(request, **kwargs) + return response + def delete_replication_document( self, doc_id: str, @@ -6337,7 +6394,7 @@ def delete_replication_document( **kwargs, ) -> DetailedResponse: """ - Cancel a replication. + Cancel a persistent replication. Cancels a replication by deleting the document that describes it from the `_replicator` database. @@ -6408,7 +6465,7 @@ def get_replication_document( **kwargs, ) -> DetailedResponse: """ - Retrieve a replication document. + Retrieve the configuration for a persistent replication. Retrieves a replication document from the `_replicator` database to view the configuration of the replication. The status of the replication is no longer @@ -6501,7 +6558,7 @@ def put_replication_document( **kwargs, ) -> DetailedResponse: """ - Create or modify a replication using a replication document. + Create or modify a persistent replication. Creates or modifies a document in the `_replicator` database to start a new replication or to edit an existing replication. @@ -6819,33 +6876,28 @@ def get_session_information( # Authorization ######################### - def get_security( + def post_api_keys( self, - db: str, **kwargs, ) -> DetailedResponse: """ - Retrieve database permissions information. + Generates API keys for apps or persons to enable database access. - See who has permission to read, write, and manage the database. The credentials - you use to log in to the dashboard automatically include `_admin` permissions to - all databases you create. Everyone and everything else, including users you share - databases with and API keys you create, must be given a permission level - explicitly. + Generates API keys to enable database access for a person or application, but + without creating a new IBM Cloudant account for that person or application. An API + key is a randomly generated username and password. The key is given the wanted + access permissions for a database. - :param str db: Path parameter to specify the database name. :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 `Security` object + :rtype: DetailedResponse with `dict` result representing a `ApiKeysResult` object """ - if not db: - raise ValueError('db must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_security', + operation_id='post_api_keys', ) headers.update(sdk_headers) @@ -6854,12 +6906,9 @@ def get_security( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['db'] - path_param_values = self.encode_path_vars(db) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/{db}/_security'.format(**path_param_dict) + url = '/_api/v2/api_keys' request = self.prepare_request( - method='GET', + method='POST', url=url, headers=headers, ) @@ -6867,24 +6916,22 @@ def get_security( response = self.send(request, **kwargs) return response - def put_security( + def put_cloudant_security_configuration( self, db: str, + cloudant: dict, *, admins: Optional['SecurityObject'] = None, - members: Optional['SecurityObject'] = None, - cloudant: Optional[dict] = None, couchdb_auth_only: Optional[bool] = None, + members: Optional['SecurityObject'] = None, **kwargs, ) -> DetailedResponse: """ - Modify database permissions. + Modify only Cloudant related database permissions. - Modify who has permission to read, write, or manage a database. This endpoint can - be used to modify both Cloudant and CouchDB related permissions. Be careful: by - removing a Cloudant API key, a member or an admin from the list of users that have - access permissions, you remove it from the list of users that have access to the - database. + Modify only Cloudant related permissions to database. Be careful: by removing an + API key from the list, you remove the API key from the list of users that have + access to the database. ### Note about nobody role The `nobody` username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not @@ -6892,14 +6939,14 @@ def put_security( `_reader`. :param str db: Path parameter to specify the database name. + :param dict cloudant: Database permissions for Cloudant users and/or API + keys. :param SecurityObject admins: (optional) Schema for names and roles to map to a database permission. - :param SecurityObject members: (optional) Schema for names and roles to map - to a database permission. - :param dict cloudant: (optional) Database permissions for Cloudant users - and/or API keys. :param bool couchdb_auth_only: (optional) Manage permissions using the `_users` database only. + :param SecurityObject members: (optional) Schema for names and roles to map + to a database permission. :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 `Ok` object @@ -6907,6 +6954,8 @@ def put_security( if not db: raise ValueError('db must be provided') + if cloudant is None: + raise ValueError('cloudant must be provided') if admins is not None: admins = convert_model(admins) if members is not None: @@ -6915,15 +6964,15 @@ def put_security( sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='put_security', + operation_id='put_cloudant_security_configuration', ) headers.update(sdk_headers) data = { - 'admins': admins, - 'members': members, 'cloudant': cloudant, + 'admins': admins, 'couchdb_auth_only': couchdb_auth_only, + 'members': members, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -6937,7 +6986,7 @@ def put_security( path_param_keys = ['db'] path_param_values = self.encode_path_vars(db) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/{db}/_security'.format(**path_param_dict) + url = '/_api/v2/db/{db}/_security'.format(**path_param_dict) request = self.prepare_request( method='PUT', url=url, @@ -6948,28 +6997,33 @@ def put_security( response = self.send(request, **kwargs) return response - def post_api_keys( + def get_security( self, + db: str, **kwargs, ) -> DetailedResponse: """ - Generates API keys for apps or persons to enable database access. + Retrieve database permissions information. - Generates API keys to enable database access for a person or application, but - without creating a new IBM Cloudant account for that person or application. An API - key is a randomly generated username and password. The key is given the wanted - access permissions for a database. + See who has permission to read, write, and manage the database. The credentials + you use to log in to the dashboard automatically include `_admin` permissions to + all databases you create. Everyone and everything else, including users you share + databases with and API keys you create, must be given a permission level + explicitly. + :param str db: Path parameter to specify the database name. :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 `ApiKeysResult` object + :rtype: DetailedResponse with `dict` result representing a `Security` object """ + if not db: + raise ValueError('db must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='post_api_keys', + operation_id='get_security', ) headers.update(sdk_headers) @@ -6978,9 +7032,12 @@ def post_api_keys( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_api/v2/api_keys' + path_param_keys = ['db'] + path_param_values = self.encode_path_vars(db) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/{db}/_security'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='GET', url=url, headers=headers, ) @@ -6988,22 +7045,24 @@ def post_api_keys( response = self.send(request, **kwargs) return response - def put_cloudant_security_configuration( + def put_security( self, db: str, - cloudant: dict, *, admins: Optional['SecurityObject'] = None, - members: Optional['SecurityObject'] = None, + cloudant: Optional[dict] = None, couchdb_auth_only: Optional[bool] = None, + members: Optional['SecurityObject'] = None, **kwargs, ) -> DetailedResponse: """ - Modify only Cloudant related database permissions. + Modify database permissions. - Modify only Cloudant related permissions to database. Be careful: by removing an - API key from the list, you remove the API key from the list of users that have - access to the database. + Modify who has permission to read, write, or manage a database. This endpoint can + be used to modify both Cloudant and CouchDB related permissions. Be careful: by + removing a Cloudant API key, a member or an admin from the list of users that have + access permissions, you remove it from the list of users that have access to the + database. ### Note about nobody role The `nobody` username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not @@ -7011,14 +7070,14 @@ def put_cloudant_security_configuration( `_reader`. :param str db: Path parameter to specify the database name. - :param dict cloudant: Database permissions for Cloudant users and/or API - keys. :param SecurityObject admins: (optional) Schema for names and roles to map to a database permission. - :param SecurityObject members: (optional) Schema for names and roles to map - to a database permission. + :param dict cloudant: (optional) Database permissions for Cloudant users + and/or API keys. :param bool couchdb_auth_only: (optional) Manage permissions using the `_users` database only. + :param SecurityObject members: (optional) Schema for names and roles to map + to a database permission. :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 `Ok` object @@ -7026,8 +7085,6 @@ def put_cloudant_security_configuration( if not db: raise ValueError('db must be provided') - if cloudant is None: - raise ValueError('cloudant must be provided') if admins is not None: admins = convert_model(admins) if members is not None: @@ -7036,15 +7093,15 @@ def put_cloudant_security_configuration( sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='put_cloudant_security_configuration', + operation_id='put_security', ) headers.update(sdk_headers) data = { - 'cloudant': cloudant, 'admins': admins, - 'members': members, + 'cloudant': cloudant, 'couchdb_auth_only': couchdb_auth_only, + 'members': members, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -7058,7 +7115,7 @@ def put_cloudant_security_configuration( path_param_keys = ['db'] path_param_values = self.encode_path_vars(db) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/_api/v2/db/{db}/_security'.format(**path_param_dict) + url = '/{db}/_security'.format(**path_param_dict) request = self.prepare_request( method='PUT', url=url, @@ -7990,27 +8047,26 @@ def get_active_tasks( response = self.send(request, **kwargs) return response - def get_membership_information( + def get_activity_tracker_events( self, **kwargs, ) -> DetailedResponse: """ - Retrieve cluster membership information. + Retrieve Activity Tracker events information. - Displays the nodes that are part of the cluster as `cluster_nodes`. The field, - `all_nodes`, displays all nodes this node knows about, including the ones that are - part of the cluster. This endpoint is useful when you set up a cluster. + Check event types that are being sent to IBM Cloud Activity Tracker for the IBM + Cloudant instance. :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 `MembershipInformation` object + :rtype: DetailedResponse with `dict` result representing a `ActivityTrackerEvents` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_membership_information', + operation_id='get_activity_tracker_events', ) headers.update(sdk_headers) @@ -8019,7 +8075,7 @@ def get_membership_information( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_membership' + url = '/_api/v2/user/activity_tracker/events' request = self.prepare_request( method='GET', url=url, @@ -8029,65 +8085,79 @@ def get_membership_information( response = self.send(request, **kwargs) return response - def get_up_information( + def post_activity_tracker_events( self, + types: List[str], **kwargs, ) -> DetailedResponse: """ - Retrieve information about whether the server is up. + Modify Activity Tracker events configuration. - Confirms that the server is up, running, and ready to respond to requests. If - `maintenance_mode` is `true` or `nolb`, the endpoint returns a 404 response. - **Tip:** The authentication for this endpoint is only enforced when using IAM. + Configure event types that are being sent to IBM Cloud Activity Tracker for the + IBM Cloudant instance. + :param List[str] types: An array of event types that are being sent to IBM + Cloud Activity Tracker for the IBM Cloudant instance. "management" is a + required element of this array. :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 `UpInformation` object + :rtype: DetailedResponse with `dict` result representing a `Ok` object """ + if types is None: + raise ValueError('types must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_up_information', + operation_id='post_activity_tracker_events', ) headers.update(sdk_headers) + data = { + 'types': types, + } + 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')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_up' + url = '/_api/v2/user/activity_tracker/events' request = self.prepare_request( - method='GET', + method='POST', url=url, headers=headers, + data=data, ) response = self.send(request, **kwargs) return response - def get_activity_tracker_events( + def get_current_throughput_information( self, **kwargs, ) -> DetailedResponse: """ - Retrieve Activity Tracker events information. + Retrieve the current provisioned throughput capacity consumption. - Check event types that are being sent to IBM Cloud Activity Tracker for the IBM - Cloudant instance. + View the current consumption of provisioned throughput capacity for an IBM + Cloudant instance. The current consumption shows the quantities of reads, writes, + and global queries conducted against the instance for a given second. :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 `ActivityTrackerEvents` object + :rtype: DetailedResponse with `dict` result representing a `CurrentThroughputInformation` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_activity_tracker_events', + operation_id='get_current_throughput_information', ) headers.update(sdk_headers) @@ -8096,7 +8166,7 @@ def get_activity_tracker_events( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_api/v2/user/activity_tracker/events' + url = '/_api/v2/user/current/throughput' request = self.prepare_request( method='GET', url=url, @@ -8106,79 +8176,66 @@ def get_activity_tracker_events( response = self.send(request, **kwargs) return response - def post_activity_tracker_events( + def get_membership_information( self, - types: List[str], **kwargs, ) -> DetailedResponse: """ - Modify Activity Tracker events configuration. + Retrieve cluster membership information. - Configure event types that are being sent to IBM Cloud Activity Tracker for the - IBM Cloudant instance. + Displays the nodes that are part of the cluster as `cluster_nodes`. The field, + `all_nodes`, displays all nodes this node knows about, including the ones that are + part of the cluster. This endpoint is useful when you set up a cluster. - :param List[str] types: An array of event types that are being sent to IBM - Cloud Activity Tracker for the IBM Cloudant instance. "management" is a - required element of this array. :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 `Ok` object + :rtype: DetailedResponse with `dict` result representing a `MembershipInformation` object """ - if types is None: - raise ValueError('types must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='post_activity_tracker_events', + operation_id='get_membership_information', ) headers.update(sdk_headers) - data = { - 'types': types, - } - 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')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_api/v2/user/activity_tracker/events' + url = '/_membership' request = self.prepare_request( - method='POST', + method='GET', url=url, headers=headers, - data=data, ) response = self.send(request, **kwargs) return response - def get_current_throughput_information( + def get_up_information( self, **kwargs, ) -> DetailedResponse: """ - Retrieve the current provisioned throughput capacity consumption. + Retrieve information about whether the server is up. - View the current consumption of provisioned throughput capacity for an IBM - Cloudant instance. The current consumption shows the quantities of reads, writes, - and global queries conducted against the instance for a given second. + Confirms that the server is up, running, and ready to respond to requests. If + `maintenance_mode` is `true` or `nolb`, the endpoint returns a 404 response. + **Tip:** The authentication for this endpoint is only enforced when using IAM. :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 `CurrentThroughputInformation` object + :rtype: DetailedResponse with `dict` result representing a `UpInformation` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_current_throughput_information', + operation_id='get_up_information', ) headers.update(sdk_headers) @@ -8187,7 +8244,7 @@ def get_current_throughput_information( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/_api/v2/user/current/throughput' + url = '/_up' request = self.prepare_request( method='GET', url=url, @@ -8228,6 +8285,16 @@ class Feed(str, Enum): EVENTSOURCE = 'eventsource' LONGPOLL = 'longpoll' NORMAL = 'normal' + class Style(str, Enum): + """ + Query parameter to specify how many revisions are returned in the changes array. + The default, `main_only`, will only return the current "winning" revision; + all_docs will return all leaf revisions (including conflicts and deleted former + conflicts). + """ + + MAIN_ONLY = 'main_only' + ALL_DOCS = 'all_docs' class PostChangesAsStreamEnums: @@ -8244,6 +8311,16 @@ class Feed(str, Enum): EVENTSOURCE = 'eventsource' LONGPOLL = 'longpoll' NORMAL = 'normal' + class Style(str, Enum): + """ + Query parameter to specify how many revisions are returned in the changes array. + The default, `main_only`, will only return the current "winning" revision; + all_docs will return all leaf revisions (including conflicts and deleted former + conflicts). + """ + + MAIN_ONLY = 'main_only' + ALL_DOCS = 'all_docs' class PostDocumentEnums: @@ -8363,6 +8440,20 @@ class Type(str, Enum): TEXT = 'text' +class PostReplicatorEnums: + """ + Enums for post_replicator parameters. + """ + + class Batch(str, Enum): + """ + Query parameter to specify whether to store in batch mode. The server will respond + with a HTTP 202 Accepted response code immediately. + """ + + OK = 'ok' + + class DeleteReplicationDocumentEnums: """ Enums for delete_replication_document parameters. @@ -9244,7 +9335,7 @@ class AllDocsResult: """ Schema for the result of an all documents operation. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of document results. :param List[DocsResultRow] rows: List of doc results. :param str update_seq: (optional) Current update sequence for the database. """ @@ -9259,7 +9350,7 @@ def __init__( """ Initialize a AllDocsResult object. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of document results. :param List[DocsResultRow] rows: List of doc results. :param str update_seq: (optional) Current update sequence for the database. """ @@ -9328,8 +9419,8 @@ class Analyzer: """ Schema for a full text search analyzer. - :param str name: (optional) Schema for the name of the Apache Lucene analyzer to - use for text indexing. The default value varies depending on the analyzer usage: + :param str name: Schema for the name of the Apache Lucene analyzer to use for + text indexing. The default value varies depending on the analyzer usage: * For search indexes the default is `standard` * For query text indexes the default is `keyword` * For a query text index default_field the default is `standard`. @@ -9339,16 +9430,16 @@ class Analyzer: def __init__( self, + name: str, *, - name: Optional[str] = None, stopwords: Optional[List[str]] = None, ) -> None: """ Initialize a Analyzer object. - :param str name: (optional) Schema for the name of the Apache Lucene - analyzer to use for text indexing. The default value varies depending on - the analyzer usage: + :param str name: Schema for the name of the Apache Lucene analyzer to use + for text indexing. The default value varies depending on the analyzer + usage: * For search indexes the default is `standard` * For query text indexes the default is `keyword` * For a query text index default_field the default is `standard`. @@ -9364,6 +9455,8 @@ def from_dict(cls, _dict: Dict) -> 'Analyzer': args = {} if (name := _dict.get('name')) is not None: args['name'] = name + else: + raise ValueError('Required property \'name\' not present in Analyzer JSON') if (stopwords := _dict.get('stopwords')) is not None: args['stopwords'] = stopwords return cls(**args) @@ -9457,8 +9550,8 @@ class AnalyzerConfiguration: """ Schema for a search analyzer configuration. - :param str name: (optional) Schema for the name of the Apache Lucene analyzer to - use for text indexing. The default value varies depending on the analyzer usage: + :param str name: Schema for the name of the Apache Lucene analyzer to use for + text indexing. The default value varies depending on the analyzer usage: * For search indexes the default is `standard` * For query text indexes the default is `keyword` * For a query text index default_field the default is `standard`. @@ -9470,17 +9563,17 @@ class AnalyzerConfiguration: def __init__( self, + name: str, *, - name: Optional[str] = None, stopwords: Optional[List[str]] = None, fields: Optional[dict] = None, ) -> None: """ Initialize a AnalyzerConfiguration object. - :param str name: (optional) Schema for the name of the Apache Lucene - analyzer to use for text indexing. The default value varies depending on - the analyzer usage: + :param str name: Schema for the name of the Apache Lucene analyzer to use + for text indexing. The default value varies depending on the analyzer + usage: * For search indexes the default is `standard` * For query text indexes the default is `keyword` * For a query text index default_field the default is `standard`. @@ -9499,6 +9592,8 @@ def from_dict(cls, _dict: Dict) -> 'AnalyzerConfiguration': args = {} if (name := _dict.get('name')) is not None: args['name'] = name + else: + raise ValueError('Required property \'name\' not present in AnalyzerConfiguration JSON') if (stopwords := _dict.get('stopwords')) is not None: args['stopwords'] = stopwords if (fields := _dict.get('fields')) is not None: @@ -11002,13 +11097,13 @@ class DatabaseInformation: has been recreated. The field name is for compatibility with old replicator versions. Do not use the value to infer timing infromation. Typically only used by replicators. + :param PartitionedIndexesInformation partitioned_indexes: (optional) Information + about database's partitioned indexes. :param DatabaseInformationProps props: Schema for database properties. :param ContentInformationSizes sizes: Schema for size information of content. :param str update_seq: An opaque string that describes the state of the database. Do not rely on this string for counting the number of updates. :param str uuid: (optional) The UUID of the database. - :param PartitionedIndexesInformation partitioned_indexes: (optional) Information - about database's partitioned indexes. """ def __init__( @@ -11027,8 +11122,8 @@ def __init__( committed_update_seq: Optional[str] = None, compacted_seq: Optional[str] = None, engine: Optional[str] = None, - uuid: Optional[str] = None, partitioned_indexes: Optional['PartitionedIndexesInformation'] = None, + uuid: Optional[str] = None, ) -> None: """ Initialize a DatabaseInformation object. @@ -11056,9 +11151,9 @@ def __init__( :param str compacted_seq: (optional) An opaque string that describes the compaction state of the database. :param str engine: (optional) The engine used for the database. - :param str uuid: (optional) The UUID of the database. :param PartitionedIndexesInformation partitioned_indexes: (optional) Information about database's partitioned indexes. + :param str uuid: (optional) The UUID of the database. """ self.cluster = cluster self.committed_update_seq = committed_update_seq @@ -11070,11 +11165,11 @@ def __init__( self.doc_del_count = doc_del_count self.engine = engine self.instance_start_time = instance_start_time + self.partitioned_indexes = partitioned_indexes self.props = props self.sizes = sizes self.update_seq = update_seq self.uuid = uuid - self.partitioned_indexes = partitioned_indexes @classmethod def from_dict(cls, _dict: Dict) -> 'DatabaseInformation': @@ -11114,6 +11209,8 @@ def from_dict(cls, _dict: Dict) -> 'DatabaseInformation': args['instance_start_time'] = instance_start_time else: raise ValueError('Required property \'instance_start_time\' not present in DatabaseInformation JSON') + if (partitioned_indexes := _dict.get('partitioned_indexes')) is not None: + args['partitioned_indexes'] = PartitionedIndexesInformation.from_dict(partitioned_indexes) if (props := _dict.get('props')) is not None: args['props'] = DatabaseInformationProps.from_dict(props) else: @@ -11128,8 +11225,6 @@ def from_dict(cls, _dict: Dict) -> 'DatabaseInformation': raise ValueError('Required property \'update_seq\' not present in DatabaseInformation JSON') if (uuid := _dict.get('uuid')) is not None: args['uuid'] = uuid - if (partitioned_indexes := _dict.get('partitioned_indexes')) is not None: - args['partitioned_indexes'] = PartitionedIndexesInformation.from_dict(partitioned_indexes) return cls(**args) @classmethod @@ -11163,6 +11258,11 @@ def to_dict(self) -> Dict: _dict['engine'] = self.engine if hasattr(self, 'instance_start_time') and self.instance_start_time is not None: _dict['instance_start_time'] = self.instance_start_time + if hasattr(self, 'partitioned_indexes') and self.partitioned_indexes is not None: + if isinstance(self.partitioned_indexes, dict): + _dict['partitioned_indexes'] = self.partitioned_indexes + else: + _dict['partitioned_indexes'] = self.partitioned_indexes.to_dict() if hasattr(self, 'props') and self.props is not None: if isinstance(self.props, dict): _dict['props'] = self.props @@ -11177,11 +11277,6 @@ def to_dict(self) -> Dict: _dict['update_seq'] = self.update_seq if hasattr(self, 'uuid') and self.uuid is not None: _dict['uuid'] = self.uuid - if hasattr(self, 'partitioned_indexes') and self.partitioned_indexes is not None: - if isinstance(self.partitioned_indexes, dict): - _dict['partitioned_indexes'] = self.partitioned_indexes - else: - _dict['partitioned_indexes'] = self.partitioned_indexes.to_dict() return _dict def _to_dict(self): @@ -13374,59 +13469,52 @@ class ExplainResultMrArgs: """ Arguments passed to the underlying view. - :param object conflicts: (optional) Schema for any JSON type. - :param str direction: (optional) Direction parameter passed to the underlying - view. - :param object end_key: (optional) Schema for any JSON type. - :param bool include_docs: (optional) A parameter that specifies whether to - include the full content of the documents in the response in the underlying - view. - :param str partition: (optional) Partition parameter passed to the underlying - view. - :param bool reduce: (optional) A parameter that specifies returning only - documents that match any of the specified keys in the underlying view. - :param bool stable: (optional) A parameter that specifies whether the view - results should be returned form a "stable" set of shards passed to the - underlying view. + :param object conflicts: Schema for any JSON type. + :param str direction: Direction parameter passed to the underlying view. + :param object end_key: Schema for any JSON type. + :param bool include_docs: A parameter that specifies whether to include the full + content of the documents in the response in the underlying view. + :param str partition: Partition parameter passed to the underlying view. + :param bool reduce: A parameter that specifies returning only documents that + match any of the specified keys in the underlying view. + :param bool stable: A parameter that specifies whether the view results should + be returned form a "stable" set of shards passed to the underlying view. :param object start_key: (optional) Schema for any JSON type. - :param object update: (optional) Schema for any JSON type. - :param str view_type: (optional) The type of the underlying view. + :param object update: Schema for any JSON type. + :param str view_type: The type of the underlying view. """ def __init__( self, + conflicts: object, + direction: str, + end_key: object, + include_docs: bool, + partition: str, + reduce: bool, + stable: bool, + update: object, + view_type: str, *, - conflicts: Optional[object] = None, - direction: Optional[str] = None, - end_key: Optional[object] = None, - include_docs: Optional[bool] = None, - partition: Optional[str] = None, - reduce: Optional[bool] = None, - stable: Optional[bool] = None, start_key: Optional[object] = None, - update: Optional[object] = None, - view_type: Optional[str] = None, ) -> None: """ Initialize a ExplainResultMrArgs object. - :param object conflicts: (optional) Schema for any JSON type. - :param str direction: (optional) Direction parameter passed to the - underlying view. - :param object end_key: (optional) Schema for any JSON type. - :param bool include_docs: (optional) A parameter that specifies whether to - include the full content of the documents in the response in the underlying + :param object conflicts: Schema for any JSON type. + :param str direction: Direction parameter passed to the underlying view. + :param object end_key: Schema for any JSON type. + :param bool include_docs: A parameter that specifies whether to include the + full content of the documents in the response in the underlying view. + :param str partition: Partition parameter passed to the underlying view. + :param bool reduce: A parameter that specifies returning only documents + that match any of the specified keys in the underlying view. + :param bool stable: A parameter that specifies whether the view results + should be returned form a "stable" set of shards passed to the underlying view. - :param str partition: (optional) Partition parameter passed to the - underlying view. - :param bool reduce: (optional) A parameter that specifies returning only - documents that match any of the specified keys in the underlying view. - :param bool stable: (optional) A parameter that specifies whether the view - results should be returned form a "stable" set of shards passed to the - underlying view. + :param object update: Schema for any JSON type. + :param str view_type: The type of the underlying view. :param object start_key: (optional) Schema for any JSON type. - :param object update: (optional) Schema for any JSON type. - :param str view_type: (optional) The type of the underlying view. """ self.conflicts = conflicts self.direction = direction @@ -13445,24 +13533,42 @@ def from_dict(cls, _dict: Dict) -> 'ExplainResultMrArgs': args = {} if (conflicts := _dict.get('conflicts')) is not None: args['conflicts'] = conflicts + else: + raise ValueError('Required property \'conflicts\' not present in ExplainResultMrArgs JSON') if (direction := _dict.get('direction')) is not None: args['direction'] = direction + else: + raise ValueError('Required property \'direction\' not present in ExplainResultMrArgs JSON') if (end_key := _dict.get('end_key')) is not None: args['end_key'] = end_key + else: + raise ValueError('Required property \'end_key\' not present in ExplainResultMrArgs JSON') if (include_docs := _dict.get('include_docs')) is not None: args['include_docs'] = include_docs + else: + raise ValueError('Required property \'include_docs\' not present in ExplainResultMrArgs JSON') if (partition := _dict.get('partition')) is not None: args['partition'] = partition + else: + raise ValueError('Required property \'partition\' not present in ExplainResultMrArgs JSON') if (reduce := _dict.get('reduce')) is not None: args['reduce'] = reduce + else: + raise ValueError('Required property \'reduce\' not present in ExplainResultMrArgs JSON') if (stable := _dict.get('stable')) is not None: args['stable'] = stable + else: + raise ValueError('Required property \'stable\' not present in ExplainResultMrArgs JSON') if (start_key := _dict.get('start_key')) is not None: args['start_key'] = start_key if (update := _dict.get('update')) is not None: args['update'] = update + else: + raise ValueError('Required property \'update\' not present in ExplainResultMrArgs JSON') if (view_type := _dict.get('view_type')) is not None: args['view_type'] = view_type + else: + raise ValueError('Required property \'view_type\' not present in ExplainResultMrArgs JSON') return cls(**args) @classmethod @@ -13518,8 +13624,8 @@ class DirectionEnum(str, Enum): Direction parameter passed to the underlying view. """ - ASC = 'asc' - DESC = 'desc' + FWD = 'fwd' + REV = 'rev' class ViewTypeEnum(str, Enum): @@ -13922,7 +14028,7 @@ class IndexAnalysisExclusionReason: """ A reason for index's exclusion. - :param str name: (optional) A reason code for index's exclusion. + :param str name: A reason code for index's exclusion. The full list of possible reason codes is following: * alphabetically_comes_after: json There is another suitable index whose name comes before that of this index. @@ -13944,13 +14050,12 @@ class IndexAnalysisExclusionReason: def __init__( self, - *, - name: Optional[str] = None, + name: str, ) -> None: """ Initialize a IndexAnalysisExclusionReason object. - :param str name: (optional) A reason code for index's exclusion. + :param str name: A reason code for index's exclusion. The full list of possible reason codes is following: * alphabetically_comes_after: json There is another suitable index whose name comes before that of this @@ -13980,6 +14085,8 @@ def from_dict(cls, _dict: Dict) -> 'IndexAnalysisExclusionReason': args = {} if (name := _dict.get('name')) is not None: args['name'] = name + else: + raise ValueError('Required property \'name\' not present in IndexAnalysisExclusionReason JSON') return cls(**args) @classmethod @@ -14737,7 +14844,7 @@ class IndexesInformation: """ Schema for information about the indexes in a database. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of query indexes in the database. :param List[IndexInformation] indexes: Indexes. """ @@ -14749,7 +14856,7 @@ def __init__( """ Initialize a IndexesInformation object. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of query indexes in the database. :param List[IndexInformation] indexes: Indexes. """ self.total_rows = total_rows @@ -16487,7 +16594,7 @@ class SchedulerDocsResult: """ Schema for a listing of replication scheduler documents. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of replication scheduler documents. :param List[SchedulerDocument] docs: Array of replication scheduler doc objects. """ @@ -16499,7 +16606,7 @@ def __init__( """ Initialize a SchedulerDocsResult object. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of replication scheduler documents. :param List[SchedulerDocument] docs: Array of replication scheduler doc objects. """ @@ -17175,7 +17282,7 @@ class SchedulerJobsResult: """ Schema for a listing of replication scheduler jobs. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of replication jobs. :param List[SchedulerJob] jobs: Array of replication job objects. """ @@ -17187,7 +17294,7 @@ def __init__( """ Initialize a SchedulerJobsResult object. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of replication jobs. :param List[SchedulerJob] jobs: Array of replication job objects. """ self.total_rows = total_rows @@ -17602,7 +17709,8 @@ class SearchResult: """ Schema for the result of a query search operation. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of rows in the index matching the search + query. The limit may truncate the number of matches returned. :param str bookmark: (optional) Opaque bookmark token used when paginating results. :param str by: (optional) Grouped search matches. @@ -17630,7 +17738,8 @@ def __init__( """ Initialize a SearchResult object. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of rows in the index matching the + search query. The limit may truncate the number of matches returned. :param List[SearchResultRow] rows: Array of row objects. :param str bookmark: (optional) Opaque bookmark token used when paginating results. @@ -17734,7 +17843,8 @@ class SearchResultProperties: """ Schema for the result of a query search operation. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of rows in the index matching the search + query. The limit may truncate the number of matches returned. :param str bookmark: (optional) Opaque bookmark token used when paginating results. :param str by: (optional) Grouped search matches. @@ -17759,7 +17869,8 @@ def __init__( """ Initialize a SearchResultProperties object. - :param int total_rows: Number of total rows. + :param int total_rows: Total number of rows in the index matching the + search query. The limit may truncate the number of matches returned. :param List[SearchResultRow] rows: Array of row objects. :param str bookmark: (optional) Opaque bookmark token used when paginating results. @@ -17946,38 +18057,38 @@ class Security: :param SecurityObject admins: (optional) Schema for names and roles to map to a database permission. - :param SecurityObject members: (optional) Schema for names and roles to map to a - database permission. :param dict cloudant: (optional) Database permissions for Cloudant users and/or API keys. :param bool couchdb_auth_only: (optional) Manage permissions using the `_users` database only. + :param SecurityObject members: (optional) Schema for names and roles to map to a + database permission. """ def __init__( self, *, admins: Optional['SecurityObject'] = None, - members: Optional['SecurityObject'] = None, cloudant: Optional[dict] = None, couchdb_auth_only: Optional[bool] = None, + members: Optional['SecurityObject'] = None, ) -> None: """ Initialize a Security object. :param SecurityObject admins: (optional) Schema for names and roles to map to a database permission. - :param SecurityObject members: (optional) Schema for names and roles to map - to a database permission. :param dict cloudant: (optional) Database permissions for Cloudant users and/or API keys. :param bool couchdb_auth_only: (optional) Manage permissions using the `_users` database only. + :param SecurityObject members: (optional) Schema for names and roles to map + to a database permission. """ self.admins = admins - self.members = members self.cloudant = cloudant self.couchdb_auth_only = couchdb_auth_only + self.members = members @classmethod def from_dict(cls, _dict: Dict) -> 'Security': @@ -17985,12 +18096,12 @@ def from_dict(cls, _dict: Dict) -> 'Security': args = {} if (admins := _dict.get('admins')) is not None: args['admins'] = SecurityObject.from_dict(admins) - if (members := _dict.get('members')) is not None: - args['members'] = SecurityObject.from_dict(members) if (cloudant := _dict.get('cloudant')) is not None: args['cloudant'] = cloudant if (couchdb_auth_only := _dict.get('couchdb_auth_only')) is not None: args['couchdb_auth_only'] = couchdb_auth_only + if (members := _dict.get('members')) is not None: + args['members'] = SecurityObject.from_dict(members) return cls(**args) @classmethod @@ -18006,15 +18117,15 @@ def to_dict(self) -> Dict: _dict['admins'] = self.admins else: _dict['admins'] = self.admins.to_dict() + if hasattr(self, 'cloudant') and self.cloudant is not None: + _dict['cloudant'] = self.cloudant + if hasattr(self, 'couchdb_auth_only') and self.couchdb_auth_only is not None: + _dict['couchdb_auth_only'] = self.couchdb_auth_only if hasattr(self, 'members') and self.members is not None: if isinstance(self.members, dict): _dict['members'] = self.members else: _dict['members'] = self.members.to_dict() - if hasattr(self, 'cloudant') and self.cloudant is not None: - _dict['cloudant'] = self.cloudant - if hasattr(self, 'couchdb_auth_only') and self.couchdb_auth_only is not None: - _dict['couchdb_auth_only'] = self.couchdb_auth_only return _dict def _to_dict(self): @@ -18215,33 +18326,33 @@ class ServerInformation: :param str couchdb: Welcome message. :param List[str] features: List of enabled optional features. + :param List[str] features_flags: List of feature flags. :param ServerVendor vendor: Schema for server vendor information. :param str version: Apache CouchDB version. - :param List[str] features_flags: List of feature flags. """ def __init__( self, couchdb: str, features: List[str], + features_flags: List[str], vendor: 'ServerVendor', version: str, - features_flags: List[str], ) -> None: """ Initialize a ServerInformation object. :param str couchdb: Welcome message. :param List[str] features: List of enabled optional features. + :param List[str] features_flags: List of feature flags. :param ServerVendor vendor: Schema for server vendor information. :param str version: Apache CouchDB version. - :param List[str] features_flags: List of feature flags. """ self.couchdb = couchdb self.features = features + self.features_flags = features_flags self.vendor = vendor self.version = version - self.features_flags = features_flags @classmethod def from_dict(cls, _dict: Dict) -> 'ServerInformation': @@ -18255,6 +18366,10 @@ def from_dict(cls, _dict: Dict) -> 'ServerInformation': args['features'] = features else: raise ValueError('Required property \'features\' not present in ServerInformation JSON') + if (features_flags := _dict.get('features_flags')) is not None: + args['features_flags'] = features_flags + else: + raise ValueError('Required property \'features_flags\' not present in ServerInformation JSON') if (vendor := _dict.get('vendor')) is not None: args['vendor'] = ServerVendor.from_dict(vendor) else: @@ -18263,10 +18378,6 @@ def from_dict(cls, _dict: Dict) -> 'ServerInformation': args['version'] = version else: raise ValueError('Required property \'version\' not present in ServerInformation JSON') - if (features_flags := _dict.get('features_flags')) is not None: - args['features_flags'] = features_flags - else: - raise ValueError('Required property \'features_flags\' not present in ServerInformation JSON') return cls(**args) @classmethod @@ -18281,6 +18392,8 @@ def to_dict(self) -> Dict: _dict['couchdb'] = self.couchdb if hasattr(self, 'features') and self.features is not None: _dict['features'] = self.features + if hasattr(self, 'features_flags') and self.features_flags is not None: + _dict['features_flags'] = self.features_flags if hasattr(self, 'vendor') and self.vendor is not None: if isinstance(self.vendor, dict): _dict['vendor'] = self.vendor @@ -18288,8 +18401,6 @@ def to_dict(self) -> Dict: _dict['vendor'] = self.vendor.to_dict() if hasattr(self, 'version') and self.version is not None: _dict['version'] = self.version - if hasattr(self, 'features_flags') and self.features_flags is not None: - _dict['features_flags'] = self.features_flags return _dict def _to_dict(self): @@ -19447,7 +19558,10 @@ class ViewResult: """ Schema for the result of a query view operation. - :param int total_rows: (optional) Number of total rows. + :param int total_rows: (optional) Total number of rows in the view index. Note + that if the request query narrows the view this is not the number of matching + rows. The number of matching rows, up to the specified `limit`, is the size of + the `rows` array. :param str update_seq: (optional) Current update sequence for the database. :param List[ViewResultRow] rows: rows. """ @@ -19463,7 +19577,10 @@ def __init__( Initialize a ViewResult object. :param List[ViewResultRow] rows: rows. - :param int total_rows: (optional) Number of total rows. + :param int total_rows: (optional) Total number of rows in the view index. + Note that if the request query narrows the view this is not the number of + matching rows. The number of matching rows, up to the specified `limit`, is + the size of the `rows` array. :param str update_seq: (optional) Current update sequence for the database. """ self.total_rows = total_rows diff --git a/stubs/gen-its-mappings.json b/stubs/gen-its-mappings.json index 981ed646..dc40ad97 100644 --- a/stubs/gen-its-mappings.json +++ b/stubs/gen-its-mappings.json @@ -383,7 +383,7 @@ "equalTo": "normal" }, "heartbeat": { - "equalTo": "0" + "equalTo": "1" }, "since": { "equalTo": "0" @@ -476,6 +476,48 @@ }, "uuid": "2da72265-1cef-3bc6-bb1b-2cdeb811ceba" }, + { + "id": "109ff4b5-4d2a-32b8-890d-f15cfe54173b", + "request": { + "urlPath": "/_replicator", + "method": "POST", + "queryParameters": { + "batch": { + "equalTo": "ok" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"source\": {\"url\": \"https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb\"}, \"target\": {\"url\": \"https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb\"}}", + "ignoreArrayOrder": false, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "body": "{\"ok\":true,\"id\":\"testString\",\"rev\":\"1-257d246167d34fcc2ca07926ba0213d1\"}", + "headers": { + "Cache-Control": "must-revalidate", + "Content-Type": "application/json", + "Date": "Fri, 20 May 2022 16:54:50 GMT", + "ETag": "W/\"22-257d246167d34fcc2ca07926ba0213d1\"", + "Location": "https://84ab8038-d8f1-450c-9645-4d16b448eb31-bluemix.cloudant.com/_replicator/testString", + "Server": "CouchDB/3.2.1 (Erlang OTP/20)", + "transaction-id": "ce157aeb0e62a81f05c0e8c9e4d24c55", + "X-Cloudant-Action": "cloudantnosqldb.replication.write", + "X-Couch-Request-ID": "ce157aeb0e", + "X-Frame-Options": "DENY", + "Strict-Transport-Security": "max-age=31536000", + "X-Content-Type-Options": "nosniff", + "X-Cloudant-Request-Class": "write", + "X-Cloudant-Backend": "bm-cc-us-east-05", + "Via": "1.1 lb1.bm-cc-us-east-05 (Glum/1.102.0)", + "Vary": "Accept-Encoding" + } + }, + "uuid": "109ff4b5-4d2a-32b8-890d-f15cfe54173b" + }, { "id": "ea621c78-5215-34ac-94ce-95e13e1182bd", "request": { @@ -1222,7 +1264,7 @@ "equalTo": "testString" }, "heartbeat": { - "equalTo": "0" + "equalTo": "1" }, "include_docs": { "equalTo": "false" @@ -2444,7 +2486,7 @@ "equalTo": "false" }, "q": { - "equalTo": "26" + "equalTo": "16" } } }, diff --git a/test/integration/test_cloudant_v1.py b/test/integration/test_cloudant_v1.py index bce02adb..354a2f69 100644 --- a/test/integration/test_cloudant_v1.py +++ b/test/integration/test_cloudant_v1.py @@ -60,16 +60,6 @@ def test_get_server_information(self): server_information = response.get_result() assert server_information is not None - @needscredentials - def test_get_uuids(self): - response = self.cloudant_service.get_uuids( - count=1, - ) - - assert response.get_status_code() == 200 - uuids_result = response.get_result() - assert uuids_result is not None - @needscredentials def test_get_capacity_throughput_information(self): response = self.cloudant_service.get_capacity_throughput_information() @@ -88,12 +78,22 @@ def test_put_capacity_throughput_configuration(self): capacity_throughput_information = response.get_result() assert capacity_throughput_information is not None + @needscredentials + def test_get_uuids(self): + response = self.cloudant_service.get_uuids( + count=1, + ) + + assert response.get_status_code() == 200 + uuids_result = response.get_result() + assert uuids_result is not None + @needscredentials def test_get_db_updates(self): response = self.cloudant_service.get_db_updates( descending=False, feed='normal', - heartbeat=0, + heartbeat=1, limit=0, timeout=60000, since='0', @@ -117,7 +117,7 @@ def test_post_changes(self): descending=False, feed='normal', filter='testString', - heartbeat=0, + heartbeat=1, include_docs=False, limit=0, seq_interval=1, @@ -145,7 +145,7 @@ def test_post_changes_as_stream(self): descending=False, feed='normal', filter='testString', - heartbeat=0, + heartbeat=1, include_docs=False, limit=0, seq_interval=1, @@ -206,7 +206,7 @@ def test_put_database(self): response = self.cloudant_service.put_database( db='testString', partitioned=False, - q=26, + q=16, ) assert response.get_status_code() == 201 @@ -1391,7 +1391,7 @@ def test_post_search(self): group_field='testString', group_limit=1, group_sort=['testString'], - ranges={'key1': {'key1': {'key1': 'testString'}}}, + ranges={'key1': {'key1': 'testString'}}, ) assert response.get_status_code() == 200 @@ -1421,7 +1421,7 @@ def test_post_search_as_stream(self): group_field='testString', group_limit=1, group_sort=['testString'], - ranges={'key1': {'key1': {'key1': 'testString'}}}, + ranges={'key1': {'key1': 'testString'}}, ) assert response.get_status_code() == 200 @@ -1465,6 +1465,110 @@ def test_head_scheduler_job(self): assert response.get_status_code() == 200 + @needscredentials + def test_post_replicator(self): + # Construct a dict representation of a Attachment model + attachment_model = { + 'content_type': 'testString', + 'data': 'VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=', + 'digest': 'testString', + 'encoded_length': 0, + 'encoding': 'testString', + 'follows': True, + 'length': 0, + 'revpos': 1, + 'stub': True, + } + # Construct a dict representation of a Revisions model + revisions_model = { + 'ids': ['testString'], + 'start': 1, + } + # Construct a dict representation of a DocumentRevisionStatus model + document_revision_status_model = { + 'rev': 'testString', + 'status': 'available', + } + # Construct a dict representation of a ReplicationCreateTargetParameters model + replication_create_target_parameters_model = { + 'n': 3, + 'partitioned': False, + 'q': 1, + } + # Construct a dict representation of a ReplicationDatabaseAuthBasic model + replication_database_auth_basic_model = { + 'password': 'testString', + 'username': 'testString', + } + # Construct a dict representation of a ReplicationDatabaseAuthIam model + replication_database_auth_iam_model = { + 'api_key': 'testString', + } + # Construct a dict representation of a ReplicationDatabaseAuth model + replication_database_auth_model = { + 'basic': replication_database_auth_basic_model, + 'iam': replication_database_auth_iam_model, + } + # Construct a dict representation of a ReplicationDatabase model + replication_database_model = { + 'auth': replication_database_auth_model, + 'headers': {'key1': 'testString'}, + 'url': 'https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb', + } + # Construct a dict representation of a UserContext model + user_context_model = { + 'db': 'testString', + 'name': 'john', + 'roles': ['_replicator'], + } + # Construct a dict representation of a ReplicationDocument model + replication_document_model = { + '_attachments': {'key1': attachment_model}, + '_conflicts': ['testString'], + '_deleted': True, + '_deleted_conflicts': ['testString'], + '_id': 'testString', + '_local_seq': 'testString', + '_rev': 'testString', + '_revisions': revisions_model, + '_revs_info': [document_revision_status_model], + 'cancel': False, + 'checkpoint_interval': 4500, + 'connection_timeout': 15000, + 'continuous': True, + 'create_target': True, + 'create_target_params': replication_create_target_parameters_model, + 'doc_ids': ['badger', 'lemur', 'llama'], + 'filter': 'ddoc/my_filter', + 'http_connections': 10, + 'owner': 'testString', + 'query_params': {'key1': 'testString'}, + 'retries_per_request': 3, + 'selector': {'_id': {'$regex': 'docid'}}, + 'since_seq': '34-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdU', + 'socket_options': '[{keepalive, true}, {nodelay, false}]', + 'source': replication_database_model, + 'source_proxy': 'testString', + 'target': replication_database_model, + 'target_proxy': 'testString', + 'use_bulk_get': True, + 'use_checkpoints': False, + 'user_ctx': user_context_model, + 'winning_revs_only': False, + 'worker_batch_size': 400, + 'worker_processes': 3, + 'foo': 'testString', + } + + response = self.cloudant_service.post_replicator( + replication_document=replication_document_model, + batch='ok', + ) + + assert response.get_status_code() == 201 + document_result = response.get_result() + assert document_result is not None + @needscredentials def test_get_replication_document(self): response = self.cloudant_service.get_replication_document( @@ -1646,29 +1750,27 @@ def test_get_session_information(self): assert session_information is not None @needscredentials - def test_get_security(self): - response = self.cloudant_service.get_security( - db='testString', - ) + def test_post_api_keys(self): + response = self.cloudant_service.post_api_keys() - assert response.get_status_code() == 200 - security = response.get_result() - assert security is not None + assert response.get_status_code() == 201 + api_keys_result = response.get_result() + assert api_keys_result is not None @needscredentials - def test_put_security(self): + def test_put_cloudant_security_configuration(self): # Construct a dict representation of a SecurityObject model security_object_model = { - 'names': ['superuser'], - 'roles': ['admins'], + 'names': ['testString'], + 'roles': ['testString'], } - response = self.cloudant_service.put_security( + response = self.cloudant_service.put_cloudant_security_configuration( db='testString', + cloudant={'antsellseadespecteposene': ['_reader', '_writer', '_admin'], 'garbados': ['_reader', '_writer'], 'nobody': ['_reader']}, admins=security_object_model, - members=security_object_model, - cloudant={'key1': ['_reader']}, couchdb_auth_only=True, + members=security_object_model, ) assert response.get_status_code() == 200 @@ -1676,27 +1778,29 @@ def test_put_security(self): assert ok is not None @needscredentials - def test_post_api_keys(self): - response = self.cloudant_service.post_api_keys() + def test_get_security(self): + response = self.cloudant_service.get_security( + db='testString', + ) - assert response.get_status_code() == 201 - api_keys_result = response.get_result() - assert api_keys_result is not None + assert response.get_status_code() == 200 + security = response.get_result() + assert security is not None @needscredentials - def test_put_cloudant_security_configuration(self): + def test_put_security(self): # Construct a dict representation of a SecurityObject model security_object_model = { - 'names': ['testString'], - 'roles': ['testString'], + 'names': ['superuser'], + 'roles': ['admins'], } - response = self.cloudant_service.put_cloudant_security_configuration( + response = self.cloudant_service.put_security( db='testString', - cloudant={'antsellseadespecteposene': ['_reader', '_writer', '_admin'], 'garbados': ['_reader', '_writer'], 'nobody': ['_reader']}, admins=security_object_model, - members=security_object_model, + cloudant={'key1': ['_reader']}, couchdb_auth_only=True, + members=security_object_model, ) assert response.get_status_code() == 200 @@ -1899,22 +2003,6 @@ def test_get_active_tasks(self): list_active_task = response.get_result() assert list_active_task is not None - @needscredentials - def test_get_membership_information(self): - response = self.cloudant_service.get_membership_information() - - assert response.get_status_code() == 200 - membership_information = response.get_result() - assert membership_information is not None - - @needscredentials - def test_get_up_information(self): - response = self.cloudant_service.get_up_information() - - assert response.get_status_code() == 200 - up_information = response.get_result() - assert up_information is not None - @needscredentials def test_get_activity_tracker_events(self): response = self.cloudant_service.get_activity_tracker_events() @@ -1941,6 +2029,22 @@ def test_get_current_throughput_information(self): current_throughput_information = response.get_result() assert current_throughput_information is not None + @needscredentials + def test_get_membership_information(self): + response = self.cloudant_service.get_membership_information() + + assert response.get_status_code() == 200 + membership_information = response.get_result() + assert membership_information is not None + + @needscredentials + def test_get_up_information(self): + response = self.cloudant_service.get_up_information() + + assert response.get_status_code() == 200 + up_information = response.get_result() + assert up_information is not None + @needscredentials def test_delete_database(self): response = self.cloudant_service.delete_database( diff --git a/test/unit/test_cloudant_v1.py b/test/unit/test_cloudant_v1.py index dfe562c2..9b71aa5d 100644 --- a/test/unit/test_cloudant_v1.py +++ b/test/unit/test_cloudant_v1.py @@ -108,7 +108,7 @@ def test_get_server_information_all_params(self): """ # Set up mock url = preprocess_url('/') - mock_response = '{"couchdb": "couchdb", "features": ["features"], "vendor": {"name": "name", "variant": "paas", "version": "version"}, "version": "version", "features_flags": ["features_flags"]}' + mock_response = '{"couchdb": "couchdb", "features": ["features"], "features_flags": ["features_flags"], "vendor": {"name": "name", "variant": "paas", "version": "version"}, "version": "version"}' responses.add( responses.GET, url, @@ -134,86 +134,6 @@ def test_get_server_information_all_params_with_retries(self): self.test_get_server_information_all_params() -class TestGetUuids: - """ - Test Class for get_uuids - """ - - @responses.activate - def test_get_uuids_all_params(self): - """ - get_uuids() - """ - # Set up mock - url = preprocess_url('/_uuids') - mock_response = '{"uuids": ["uuids"]}' - responses.add( - responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200, - ) - - # Set up parameter values - count = 1 - - # Invoke method - response = _service.get_uuids( - count=count, - 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 'count={}'.format(count) in query_string - - def test_get_uuids_all_params_with_retries(self): - # Enable retries and run test_get_uuids_all_params. - _service.enable_retries() - self.test_get_uuids_all_params() - - # Disable retries and run test_get_uuids_all_params. - _service.disable_retries() - self.test_get_uuids_all_params() - - @responses.activate - def test_get_uuids_required_params(self): - """ - test_get_uuids_required_params() - """ - # Set up mock - url = preprocess_url('/_uuids') - mock_response = '{"uuids": ["uuids"]}' - responses.add( - responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200, - ) - - # Invoke method - response = _service.get_uuids() - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_get_uuids_required_params_with_retries(self): - # Enable retries and run test_get_uuids_required_params. - _service.enable_retries() - self.test_get_uuids_required_params() - - # Disable retries and run test_get_uuids_required_params. - _service.disable_retries() - self.test_get_uuids_required_params() - - class TestGetCapacityThroughputInformation: """ Test Class for get_capacity_throughput_information @@ -340,6 +260,86 @@ def test_put_capacity_throughput_configuration_value_error_with_retries(self): self.test_put_capacity_throughput_configuration_value_error() +class TestGetUuids: + """ + Test Class for get_uuids + """ + + @responses.activate + def test_get_uuids_all_params(self): + """ + get_uuids() + """ + # Set up mock + url = preprocess_url('/_uuids') + mock_response = '{"uuids": ["uuids"]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + count = 1 + + # Invoke method + response = _service.get_uuids( + count=count, + 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 'count={}'.format(count) in query_string + + def test_get_uuids_all_params_with_retries(self): + # Enable retries and run test_get_uuids_all_params. + _service.enable_retries() + self.test_get_uuids_all_params() + + # Disable retries and run test_get_uuids_all_params. + _service.disable_retries() + self.test_get_uuids_all_params() + + @responses.activate + def test_get_uuids_required_params(self): + """ + test_get_uuids_required_params() + """ + # Set up mock + url = preprocess_url('/_uuids') + mock_response = '{"uuids": ["uuids"]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Invoke method + response = _service.get_uuids() + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_uuids_required_params_with_retries(self): + # Enable retries and run test_get_uuids_required_params. + _service.enable_retries() + self.test_get_uuids_required_params() + + # Disable retries and run test_get_uuids_required_params. + _service.disable_retries() + self.test_get_uuids_required_params() + + # endregion ############################################################################## # End of Service: Server @@ -403,7 +403,7 @@ def test_get_db_updates_all_params(self): # Set up parameter values descending = False feed = 'normal' - heartbeat = 0 + heartbeat = 1 limit = 0 timeout = 60000 since = '0' @@ -486,7 +486,7 @@ def test_post_changes_all_params(self): """ # Set up mock url = preprocess_url('/testString/_changes') - mock_response = '{"last_seq": "last_seq", "pending": 7, "results": [{"changes": [{"rev": "rev"}], "deleted": false, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "seq": "seq"}]}' + mock_response = '{"last_seq": "last_seq", "pending": 0, "results": [{"changes": [{"rev": "rev"}], "deleted": false, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "seq": "seq"}]}' responses.add( responses.POST, url, @@ -507,7 +507,7 @@ def test_post_changes_all_params(self): descending = False feed = 'normal' filter = 'testString' - heartbeat = 0 + heartbeat = 1 include_docs = False limit = 0 seq_interval = 1 @@ -586,7 +586,7 @@ def test_post_changes_required_params(self): """ # Set up mock url = preprocess_url('/testString/_changes') - mock_response = '{"last_seq": "last_seq", "pending": 7, "results": [{"changes": [{"rev": "rev"}], "deleted": false, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "seq": "seq"}]}' + mock_response = '{"last_seq": "last_seq", "pending": 0, "results": [{"changes": [{"rev": "rev"}], "deleted": false, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "seq": "seq"}]}' responses.add( responses.POST, url, @@ -639,7 +639,7 @@ def test_post_changes_value_error(self): """ # Set up mock url = preprocess_url('/testString/_changes') - mock_response = '{"last_seq": "last_seq", "pending": 7, "results": [{"changes": [{"rev": "rev"}], "deleted": false, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "seq": "seq"}]}' + mock_response = '{"last_seq": "last_seq", "pending": 0, "results": [{"changes": [{"rev": "rev"}], "deleted": false, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "seq": "seq"}]}' responses.add( responses.POST, url, @@ -706,7 +706,7 @@ def test_post_changes_as_stream_all_params(self): descending = False feed = 'normal' filter = 'testString' - heartbeat = 0 + heartbeat = 1 include_docs = False limit = 0 seq_interval = 1 @@ -1102,7 +1102,7 @@ def test_post_dbs_info_all_params(self): """ # Set up mock url = preprocess_url('/_dbs_info') - mock_response = '[{"error": "error", "info": {"cluster": {"n": 3, "q": 1, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 19, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "props": {"partitioned": false}, "sizes": {"active": 6, "external": 8, "file": 4}, "update_seq": "update_seq", "uuid": "uuid", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}}, "key": "key"}]' + mock_response = '[{"error": "error", "info": {"cluster": {"n": 3, "q": 16, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 1, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}, "props": {"partitioned": false}, "sizes": {"active": 0, "external": 0, "file": 0}, "update_seq": "update_seq", "uuid": "uuid"}, "key": "key"}]' responses.add( responses.POST, url, @@ -1147,7 +1147,7 @@ def test_post_dbs_info_value_error(self): """ # Set up mock url = preprocess_url('/_dbs_info') - mock_response = '[{"error": "error", "info": {"cluster": {"n": 3, "q": 1, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 19, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "props": {"partitioned": false}, "sizes": {"active": 6, "external": 8, "file": 4}, "update_seq": "update_seq", "uuid": "uuid", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}}, "key": "key"}]' + mock_response = '[{"error": "error", "info": {"cluster": {"n": 3, "q": 16, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 1, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}, "props": {"partitioned": false}, "sizes": {"active": 0, "external": 0, "file": 0}, "update_seq": "update_seq", "uuid": "uuid"}, "key": "key"}]' responses.add( responses.POST, url, @@ -1271,7 +1271,7 @@ def test_get_database_information_all_params(self): """ # Set up mock url = preprocess_url('/testString') - mock_response = '{"cluster": {"n": 3, "q": 1, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 19, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "props": {"partitioned": false}, "sizes": {"active": 6, "external": 8, "file": 4}, "update_seq": "update_seq", "uuid": "uuid", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}}' + mock_response = '{"cluster": {"n": 3, "q": 16, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 1, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}, "props": {"partitioned": false}, "sizes": {"active": 0, "external": 0, "file": 0}, "update_seq": "update_seq", "uuid": "uuid"}' responses.add( responses.GET, url, @@ -1309,7 +1309,7 @@ def test_get_database_information_value_error(self): """ # Set up mock url = preprocess_url('/testString') - mock_response = '{"cluster": {"n": 3, "q": 1, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 19, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "props": {"partitioned": false}, "sizes": {"active": 6, "external": 8, "file": 4}, "update_seq": "update_seq", "uuid": "uuid", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}}' + mock_response = '{"cluster": {"n": 3, "q": 16, "r": 1, "w": 1}, "committed_update_seq": "committed_update_seq", "compact_running": false, "compacted_seq": "compacted_seq", "db_name": "db_name", "disk_format_version": 1, "doc_count": 0, "doc_del_count": 0, "engine": "engine", "instance_start_time": "instance_start_time", "partitioned_indexes": {"count": 0, "indexes": {"search": 0, "view": 0}, "limit": 10}, "props": {"partitioned": false}, "sizes": {"active": 0, "external": 0, "file": 0}, "update_seq": "update_seq", "uuid": "uuid"}' responses.add( responses.GET, url, @@ -1364,7 +1364,7 @@ def test_put_database_all_params(self): # Set up parameter values db = 'testString' partitioned = False - q = 26 + q = 16 # Invoke method response = _service.put_database( @@ -1646,7 +1646,7 @@ def test_post_document_all_params(self): """ # Set up mock url = preprocess_url('/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.POST, url, @@ -1743,7 +1743,7 @@ def test_post_document_required_params(self): """ # Set up mock url = preprocess_url('/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.POST, url, @@ -1832,7 +1832,7 @@ def test_post_document_value_error(self): """ # Set up mock url = preprocess_url('/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.POST, url, @@ -1921,7 +1921,7 @@ def test_post_all_docs_all_params(self): """ # Set up mock url = preprocess_url('/testString/_all_docs') - mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' + mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' responses.add( responses.POST, url, @@ -2004,7 +2004,7 @@ def test_post_all_docs_value_error(self): """ # Set up mock url = preprocess_url('/testString/_all_docs') - mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' + mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' responses.add( responses.POST, url, @@ -2205,7 +2205,7 @@ def test_post_all_docs_queries_all_params(self): """ # Set up mock url = preprocess_url('/testString/_all_docs/queries') - mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' + mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' responses.add( responses.POST, url, @@ -2268,7 +2268,7 @@ def test_post_all_docs_queries_value_error(self): """ # Set up mock url = preprocess_url('/testString/_all_docs/queries') - mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' + mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' responses.add( responses.POST, url, @@ -2459,7 +2459,7 @@ def test_post_bulk_docs_all_params(self): """ # Set up mock url = preprocess_url('/testString/_bulk_docs') - mock_response = '[{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}]' + mock_response = '[{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}]' responses.add( responses.POST, url, @@ -2550,7 +2550,7 @@ def test_post_bulk_docs_value_error(self): """ # Set up mock url = preprocess_url('/testString/_bulk_docs') - mock_response = '[{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}]' + mock_response = '[{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}]' responses.add( responses.POST, url, @@ -2639,7 +2639,7 @@ def test_post_bulk_get_all_params(self): """ # Set up mock url = preprocess_url('/testString/_bulk_get') - mock_response = '{"results": [{"docs": [{"error": {"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}, "ok": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}}], "id": "id"}]}' + mock_response = '{"results": [{"docs": [{"error": {"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}, "ok": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}}], "id": "id"}]}' responses.add( responses.POST, url, @@ -2707,7 +2707,7 @@ def test_post_bulk_get_required_params(self): """ # Set up mock url = preprocess_url('/testString/_bulk_get') - mock_response = '{"results": [{"docs": [{"error": {"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}, "ok": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}}], "id": "id"}]}' + mock_response = '{"results": [{"docs": [{"error": {"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}, "ok": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}}], "id": "id"}]}' responses.add( responses.POST, url, @@ -2760,7 +2760,7 @@ def test_post_bulk_get_value_error(self): """ # Set up mock url = preprocess_url('/testString/_bulk_get') - mock_response = '{"results": [{"docs": [{"error": {"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}, "ok": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}}], "id": "id"}]}' + mock_response = '{"results": [{"docs": [{"error": {"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}, "ok": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}}], "id": "id"}]}' responses.add( responses.POST, url, @@ -3339,7 +3339,7 @@ def test_delete_document_all_params(self): """ # Set up mock url = preprocess_url('/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -3390,7 +3390,7 @@ def test_delete_document_required_params(self): """ # Set up mock url = preprocess_url('/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -3430,7 +3430,7 @@ def test_delete_document_value_error(self): """ # Set up mock url = preprocess_url('/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -4127,7 +4127,7 @@ def test_put_document_all_params(self): """ # Set up mock url = preprocess_url('/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -4234,7 +4234,7 @@ def test_put_document_required_params(self): """ # Set up mock url = preprocess_url('/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -4325,7 +4325,7 @@ def test_put_document_value_error(self): """ # Set up mock url = preprocess_url('/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -4573,7 +4573,7 @@ def test_delete_design_document_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -4624,7 +4624,7 @@ def test_delete_design_document_required_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -4664,7 +4664,7 @@ def test_delete_design_document_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -4869,7 +4869,7 @@ def test_put_design_document_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -4999,7 +4999,7 @@ def test_put_design_document_required_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -5115,7 +5115,7 @@ def test_put_design_document_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -5229,7 +5229,7 @@ def test_get_design_document_information_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_info') - mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 6, "external": 8, "file": 4}, "updater_running": false, "updates_pending": {"minimum": 7, "preferred": 9, "total": 5}, "waiting_clients": 0, "waiting_commit": true}}' + mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 0, "external": 0, "file": 0}, "updater_running": false, "updates_pending": {"minimum": 0, "preferred": 0, "total": 0}, "waiting_clients": 0, "waiting_commit": true}}' responses.add( responses.GET, url, @@ -5269,7 +5269,7 @@ def test_get_design_document_information_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_info') - mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 6, "external": 8, "file": 4}, "updater_running": false, "updates_pending": {"minimum": 7, "preferred": 9, "total": 5}, "waiting_clients": 0, "waiting_commit": true}}' + mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 0, "external": 0, "file": 0}, "updater_running": false, "updates_pending": {"minimum": 0, "preferred": 0, "total": 0}, "waiting_clients": 0, "waiting_commit": true}}' responses.add( responses.GET, url, @@ -5314,7 +5314,7 @@ def test_post_design_docs_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design_docs') - mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' + mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' responses.add( responses.POST, url, @@ -5397,7 +5397,7 @@ def test_post_design_docs_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design_docs') - mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' + mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' responses.add( responses.POST, url, @@ -5453,7 +5453,7 @@ def test_post_design_docs_queries_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design_docs/queries') - mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' + mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' responses.add( responses.POST, url, @@ -5518,7 +5518,7 @@ def test_post_design_docs_queries_required_params(self): """ # Set up mock url = preprocess_url('/testString/_design_docs/queries') - mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' + mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' responses.add( responses.POST, url, @@ -5581,7 +5581,7 @@ def test_post_design_docs_queries_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design_docs/queries') - mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' + mock_response = '{"results": [{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}]}' responses.add( responses.POST, url, @@ -5681,7 +5681,7 @@ def test_post_view_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_view/testString') - mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' + mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' responses.add( responses.POST, url, @@ -5789,7 +5789,7 @@ def test_post_view_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_view/testString') - mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' + mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' responses.add( responses.POST, url, @@ -6037,7 +6037,7 @@ def test_post_view_queries_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_view/testString/queries') - mock_response = '{"results": [{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}]}' + mock_response = '{"results": [{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}]}' responses.add( responses.POST, url, @@ -6111,7 +6111,7 @@ def test_post_view_queries_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_view/testString/queries') - mock_response = '{"results": [{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}]}' + mock_response = '{"results": [{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}]}' responses.add( responses.POST, url, @@ -6459,7 +6459,7 @@ def test_post_partition_all_docs_all_params(self): """ # Set up mock url = preprocess_url('/testString/_partition/testString/_all_docs') - mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' + mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' responses.add( responses.POST, url, @@ -6544,7 +6544,7 @@ def test_post_partition_all_docs_value_error(self): """ # Set up mock url = preprocess_url('/testString/_partition/testString/_all_docs') - mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' + mock_response = '{"total_rows": 0, "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "key", "value": {"deleted": false, "rev": "rev"}}], "update_seq": "update_seq"}' responses.add( responses.POST, url, @@ -7053,7 +7053,7 @@ def test_post_partition_view_all_params(self): """ # Set up mock url = preprocess_url('/testString/_partition/testString/_design/testString/_view/testString') - mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' + mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' responses.add( responses.POST, url, @@ -7160,7 +7160,7 @@ def test_post_partition_view_value_error(self): """ # Set up mock url = preprocess_url('/testString/_partition/testString/_design/testString/_view/testString') - mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' + mock_response = '{"total_rows": 0, "update_seq": "update_seq", "rows": [{"caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0, "doc": {"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}]}, "id": "id", "key": "anyValue", "value": "anyValue"}]}' responses.add( responses.POST, url, @@ -7409,7 +7409,7 @@ def test_post_partition_explain_all_params(self): """ # Set up mock url = preprocess_url('/testString/_partition/testString/_explain') - mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "asc", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' + mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "fwd", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' responses.add( responses.POST, url, @@ -7491,7 +7491,7 @@ def test_post_partition_explain_value_error(self): """ # Set up mock url = preprocess_url('/testString/_partition/testString/_explain') - mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "asc", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' + mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "fwd", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' responses.add( responses.POST, url, @@ -7874,7 +7874,7 @@ def test_post_explain_all_params(self): """ # Set up mock url = preprocess_url('/testString/_explain') - mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "asc", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' + mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "fwd", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' responses.add( responses.POST, url, @@ -7957,7 +7957,7 @@ def test_post_explain_value_error(self): """ # Set up mock url = preprocess_url('/testString/_explain') - mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "asc", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' + mock_response = '{"covering": true, "dbname": "dbname", "fields": ["fields"], "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}, "index_candidates": [{"analysis": {"covering": true, "ranking": 1, "reasons": [{"name": "alphabetically_comes_after"}], "usable": true}, "index": {"ddoc": "ddoc", "def": {"default_analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "default_field": {"analyzer": {"name": "classic", "stopwords": ["stopwords"]}, "enabled": true}, "fields": [{"name": "name", "type": "boolean"}], "index_array_lengths": true, "partial_filter_selector": {"anyKey": "anyValue"}}, "name": "name", "partitioned": false, "type": "json"}}], "limit": 25, "mrargs": {"conflicts": "anyValue", "direction": "fwd", "end_key": "anyValue", "include_docs": true, "partition": "partition", "reduce": true, "stable": true, "start_key": "anyValue", "update": "anyValue", "view_type": "map"}, "opts": {"bookmark": "bookmark", "conflicts": false, "execution_stats": false, "fields": ["fields"], "limit": 25, "partition": "partition", "r": 1, "skip": 0, "sort": "anyValue", "stable": false, "stale": false, "update": true, "use_index": ["use_index"]}, "partitioned": "anyValue", "selector": {"anyKey": "anyValue"}, "selector_hints": [{"indexable_fields": ["indexable_fields"], "type": "json", "unindexable_fields": ["unindexable_fields"]}], "skip": 0}' responses.add( responses.POST, url, @@ -8792,7 +8792,7 @@ def test_post_search_all_params(self): group_field = 'testString' group_limit = 1 group_sort = ['testString'] - ranges = {'key1': {'key1': {'key1': 'testString'}}} + ranges = {'key1': {'key1': 'testString'}} # Invoke method response = _service.post_search( @@ -8846,7 +8846,7 @@ def test_post_search_all_params(self): assert req_body['group_field'] == 'testString' assert req_body['group_limit'] == 1 assert req_body['group_sort'] == ['testString'] - assert req_body['ranges'] == {'key1': {'key1': {'key1': 'testString'}}} + assert req_body['ranges'] == {'key1': {'key1': 'testString'}} def test_post_search_all_params_with_retries(self): # Enable retries and run test_post_search_all_params. @@ -8894,7 +8894,7 @@ def test_post_search_value_error(self): group_field = 'testString' group_limit = 1 group_sort = ['testString'] - ranges = {'key1': {'key1': {'key1': 'testString'}}} + ranges = {'key1': {'key1': 'testString'}} # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -8960,7 +8960,7 @@ def test_post_search_as_stream_all_params(self): group_field = 'testString' group_limit = 1 group_sort = ['testString'] - ranges = {'key1': {'key1': {'key1': 'testString'}}} + ranges = {'key1': {'key1': 'testString'}} # Invoke method response = _service.post_search_as_stream( @@ -9014,7 +9014,7 @@ def test_post_search_as_stream_all_params(self): assert req_body['group_field'] == 'testString' assert req_body['group_limit'] == 1 assert req_body['group_sort'] == ['testString'] - assert req_body['ranges'] == {'key1': {'key1': {'key1': 'testString'}}} + assert req_body['ranges'] == {'key1': {'key1': 'testString'}} # Verify streamed JSON response result = response.get_result() @@ -9068,7 +9068,7 @@ def test_post_search_as_stream_value_error(self): group_field = 'testString' group_limit = 1 group_sort = ['testString'] - ranges = {'key1': {'key1': {'key1': 'testString'}}} + ranges = {'key1': {'key1': 'testString'}} # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -9104,7 +9104,7 @@ def test_get_search_info_all_params(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_search_info/testString') - mock_response = '{"name": "name", "search_index": {"committed_seq": 13, "disk_size": 0, "doc_count": 0, "doc_del_count": 0, "pending_seq": 11, "signature": "signature"}}' + mock_response = '{"name": "name", "search_index": {"committed_seq": 0, "disk_size": 0, "doc_count": 0, "doc_del_count": 0, "pending_seq": 0, "signature": "signature"}}' responses.add( responses.GET, url, @@ -9146,7 +9146,7 @@ def test_get_search_info_value_error(self): """ # Set up mock url = preprocess_url('/testString/_design/testString/_search_info/testString') - mock_response = '{"name": "name", "search_index": {"committed_seq": 13, "disk_size": 0, "doc_count": 0, "doc_del_count": 0, "pending_seq": 11, "signature": "signature"}}' + mock_response = '{"name": "name", "search_index": {"committed_seq": 0, "disk_size": 0, "doc_count": 0, "doc_del_count": 0, "pending_seq": 0, "signature": "signature"}}' responses.add( responses.GET, url, @@ -9482,87 +9482,502 @@ def test_head_scheduler_job_value_error_with_retries(self): self.test_head_scheduler_job_value_error() -class TestDeleteReplicationDocument: +class TestPostReplicator: """ - Test Class for delete_replication_document + Test Class for post_replicator """ @responses.activate - def test_delete_replication_document_all_params(self): + def test_post_replicator_all_params(self): """ - delete_replication_document() + post_replicator() """ # Set up mock - url = preprocess_url('/_replicator/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + url = preprocess_url('/_replicator') + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( - responses.DELETE, + responses.POST, url, body=mock_response, content_type='application/json', - status=200, + status=201, ) - # Set up parameter values - doc_id = 'testString' - if_match = 'testString' - batch = 'ok' - rev = 'testString' - - # Invoke method - response = _service.delete_replication_document( - doc_id, - if_match=if_match, - batch=batch, - rev=rev, - headers={}, - ) + # Construct a dict representation of a Attachment model + attachment_model = {} + attachment_model['content_type'] = 'testString' + attachment_model['data'] = 'VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=' + attachment_model['digest'] = 'testString' + attachment_model['encoded_length'] = 0 + attachment_model['encoding'] = 'testString' + attachment_model['follows'] = True + attachment_model['length'] = 0 + attachment_model['revpos'] = 1 + attachment_model['stub'] = True - # 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 'batch={}'.format(batch) in query_string - assert 'rev={}'.format(rev) in query_string + # Construct a dict representation of a Revisions model + revisions_model = {} + revisions_model['ids'] = ['testString'] + revisions_model['start'] = 1 - def test_delete_replication_document_all_params_with_retries(self): - # Enable retries and run test_delete_replication_document_all_params. - _service.enable_retries() - self.test_delete_replication_document_all_params() + # Construct a dict representation of a DocumentRevisionStatus model + document_revision_status_model = {} + document_revision_status_model['rev'] = 'testString' + document_revision_status_model['status'] = 'available' - # Disable retries and run test_delete_replication_document_all_params. - _service.disable_retries() - self.test_delete_replication_document_all_params() + # Construct a dict representation of a ReplicationCreateTargetParameters model + replication_create_target_parameters_model = {} + replication_create_target_parameters_model['n'] = 3 + replication_create_target_parameters_model['partitioned'] = False + replication_create_target_parameters_model['q'] = 1 - @responses.activate - def test_delete_replication_document_required_params(self): - """ - test_delete_replication_document_required_params() - """ - # Set up mock - url = preprocess_url('/_replicator/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' - responses.add( - responses.DELETE, - url, - body=mock_response, - content_type='application/json', - status=200, - ) + # Construct a dict representation of a ReplicationDatabaseAuthBasic model + replication_database_auth_basic_model = {} + replication_database_auth_basic_model['password'] = 'testString' + replication_database_auth_basic_model['username'] = 'testString' - # Set up parameter values - doc_id = 'testString' + # Construct a dict representation of a ReplicationDatabaseAuthIam model + replication_database_auth_iam_model = {} + replication_database_auth_iam_model['api_key'] = 'testString' - # Invoke method - response = _service.delete_replication_document( - doc_id, - headers={}, - ) + # Construct a dict representation of a ReplicationDatabaseAuth model + replication_database_auth_model = {} + replication_database_auth_model['basic'] = replication_database_auth_basic_model + replication_database_auth_model['iam'] = replication_database_auth_iam_model - # Check for correct operation - assert len(responses.calls) == 1 + # Construct a dict representation of a ReplicationDatabase model + replication_database_model = {} + replication_database_model['auth'] = replication_database_auth_model + replication_database_model['headers'] = {'key1': 'testString'} + replication_database_model['url'] = 'https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb' + + # Construct a dict representation of a UserContext model + user_context_model = {} + user_context_model['db'] = 'testString' + user_context_model['name'] = 'john' + user_context_model['roles'] = ['_replicator'] + + # Construct a dict representation of a ReplicationDocument model + replication_document_model = {} + replication_document_model['_attachments'] = {'key1': attachment_model} + replication_document_model['_conflicts'] = ['testString'] + replication_document_model['_deleted'] = True + replication_document_model['_deleted_conflicts'] = ['testString'] + replication_document_model['_id'] = 'testString' + replication_document_model['_local_seq'] = 'testString' + replication_document_model['_rev'] = 'testString' + replication_document_model['_revisions'] = revisions_model + replication_document_model['_revs_info'] = [document_revision_status_model] + replication_document_model['cancel'] = False + replication_document_model['checkpoint_interval'] = 4500 + replication_document_model['connection_timeout'] = 15000 + replication_document_model['continuous'] = True + replication_document_model['create_target'] = True + replication_document_model['create_target_params'] = replication_create_target_parameters_model + replication_document_model['doc_ids'] = ['badger', 'lemur', 'llama'] + replication_document_model['filter'] = 'ddoc/my_filter' + replication_document_model['http_connections'] = 10 + replication_document_model['owner'] = 'testString' + replication_document_model['query_params'] = {'key1': 'testString'} + replication_document_model['retries_per_request'] = 3 + replication_document_model['selector'] = {'_id': {'$regex': 'docid'}} + replication_document_model['since_seq'] = '34-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdU' + replication_document_model['socket_options'] = '[{keepalive, true}, {nodelay, false}]' + replication_document_model['source'] = replication_database_model + replication_document_model['source_proxy'] = 'testString' + replication_document_model['target'] = replication_database_model + replication_document_model['target_proxy'] = 'testString' + replication_document_model['use_bulk_get'] = True + replication_document_model['use_checkpoints'] = False + replication_document_model['user_ctx'] = user_context_model + replication_document_model['winning_revs_only'] = False + replication_document_model['worker_batch_size'] = 400 + replication_document_model['worker_processes'] = 3 + replication_document_model['foo'] = 'testString' + + # Set up parameter values + replication_document = replication_document_model + batch = 'ok' + + # Invoke method + response = _service.post_replicator( + replication_document, + batch=batch, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'batch={}'.format(batch) in query_string + # Decompress gzip compressed request body. + raw_body = responses.calls[0].request.body + responses.calls[0].request.body = gzip.decompress(raw_body.read() if isinstance(raw_body, io.IOBase) else raw_body) + + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == replication_document + + def test_post_replicator_all_params_with_retries(self): + # Enable retries and run test_post_replicator_all_params. + _service.enable_retries() + self.test_post_replicator_all_params() + + # Disable retries and run test_post_replicator_all_params. + _service.disable_retries() + self.test_post_replicator_all_params() + + @responses.activate + def test_post_replicator_required_params(self): + """ + test_post_replicator_required_params() + """ + # Set up mock + url = preprocess_url('/_replicator') + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a Attachment model + attachment_model = {} + attachment_model['content_type'] = 'testString' + attachment_model['data'] = 'VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=' + attachment_model['digest'] = 'testString' + attachment_model['encoded_length'] = 0 + attachment_model['encoding'] = 'testString' + attachment_model['follows'] = True + attachment_model['length'] = 0 + attachment_model['revpos'] = 1 + attachment_model['stub'] = True + + # Construct a dict representation of a Revisions model + revisions_model = {} + revisions_model['ids'] = ['testString'] + revisions_model['start'] = 1 + + # Construct a dict representation of a DocumentRevisionStatus model + document_revision_status_model = {} + document_revision_status_model['rev'] = 'testString' + document_revision_status_model['status'] = 'available' + + # Construct a dict representation of a ReplicationCreateTargetParameters model + replication_create_target_parameters_model = {} + replication_create_target_parameters_model['n'] = 3 + replication_create_target_parameters_model['partitioned'] = False + replication_create_target_parameters_model['q'] = 1 + + # Construct a dict representation of a ReplicationDatabaseAuthBasic model + replication_database_auth_basic_model = {} + replication_database_auth_basic_model['password'] = 'testString' + replication_database_auth_basic_model['username'] = 'testString' + + # Construct a dict representation of a ReplicationDatabaseAuthIam model + replication_database_auth_iam_model = {} + replication_database_auth_iam_model['api_key'] = 'testString' + + # Construct a dict representation of a ReplicationDatabaseAuth model + replication_database_auth_model = {} + replication_database_auth_model['basic'] = replication_database_auth_basic_model + replication_database_auth_model['iam'] = replication_database_auth_iam_model + + # Construct a dict representation of a ReplicationDatabase model + replication_database_model = {} + replication_database_model['auth'] = replication_database_auth_model + replication_database_model['headers'] = {'key1': 'testString'} + replication_database_model['url'] = 'https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb' + + # Construct a dict representation of a UserContext model + user_context_model = {} + user_context_model['db'] = 'testString' + user_context_model['name'] = 'john' + user_context_model['roles'] = ['_replicator'] + + # Construct a dict representation of a ReplicationDocument model + replication_document_model = {} + replication_document_model['_attachments'] = {'key1': attachment_model} + replication_document_model['_conflicts'] = ['testString'] + replication_document_model['_deleted'] = True + replication_document_model['_deleted_conflicts'] = ['testString'] + replication_document_model['_id'] = 'testString' + replication_document_model['_local_seq'] = 'testString' + replication_document_model['_rev'] = 'testString' + replication_document_model['_revisions'] = revisions_model + replication_document_model['_revs_info'] = [document_revision_status_model] + replication_document_model['cancel'] = False + replication_document_model['checkpoint_interval'] = 4500 + replication_document_model['connection_timeout'] = 15000 + replication_document_model['continuous'] = True + replication_document_model['create_target'] = True + replication_document_model['create_target_params'] = replication_create_target_parameters_model + replication_document_model['doc_ids'] = ['badger', 'lemur', 'llama'] + replication_document_model['filter'] = 'ddoc/my_filter' + replication_document_model['http_connections'] = 10 + replication_document_model['owner'] = 'testString' + replication_document_model['query_params'] = {'key1': 'testString'} + replication_document_model['retries_per_request'] = 3 + replication_document_model['selector'] = {'_id': {'$regex': 'docid'}} + replication_document_model['since_seq'] = '34-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdU' + replication_document_model['socket_options'] = '[{keepalive, true}, {nodelay, false}]' + replication_document_model['source'] = replication_database_model + replication_document_model['source_proxy'] = 'testString' + replication_document_model['target'] = replication_database_model + replication_document_model['target_proxy'] = 'testString' + replication_document_model['use_bulk_get'] = True + replication_document_model['use_checkpoints'] = False + replication_document_model['user_ctx'] = user_context_model + replication_document_model['winning_revs_only'] = False + replication_document_model['worker_batch_size'] = 400 + replication_document_model['worker_processes'] = 3 + replication_document_model['foo'] = 'testString' + + # Set up parameter values + replication_document = replication_document_model + + # Invoke method + response = _service.post_replicator( + replication_document, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Decompress gzip compressed request body. + raw_body = responses.calls[0].request.body + responses.calls[0].request.body = gzip.decompress(raw_body.read() if isinstance(raw_body, io.IOBase) else raw_body) + + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == replication_document + + def test_post_replicator_required_params_with_retries(self): + # Enable retries and run test_post_replicator_required_params. + _service.enable_retries() + self.test_post_replicator_required_params() + + # Disable retries and run test_post_replicator_required_params. + _service.disable_retries() + self.test_post_replicator_required_params() + + @responses.activate + def test_post_replicator_value_error(self): + """ + test_post_replicator_value_error() + """ + # Set up mock + url = preprocess_url('/_replicator') + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a Attachment model + attachment_model = {} + attachment_model['content_type'] = 'testString' + attachment_model['data'] = 'VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=' + attachment_model['digest'] = 'testString' + attachment_model['encoded_length'] = 0 + attachment_model['encoding'] = 'testString' + attachment_model['follows'] = True + attachment_model['length'] = 0 + attachment_model['revpos'] = 1 + attachment_model['stub'] = True + + # Construct a dict representation of a Revisions model + revisions_model = {} + revisions_model['ids'] = ['testString'] + revisions_model['start'] = 1 + + # Construct a dict representation of a DocumentRevisionStatus model + document_revision_status_model = {} + document_revision_status_model['rev'] = 'testString' + document_revision_status_model['status'] = 'available' + + # Construct a dict representation of a ReplicationCreateTargetParameters model + replication_create_target_parameters_model = {} + replication_create_target_parameters_model['n'] = 3 + replication_create_target_parameters_model['partitioned'] = False + replication_create_target_parameters_model['q'] = 1 + + # Construct a dict representation of a ReplicationDatabaseAuthBasic model + replication_database_auth_basic_model = {} + replication_database_auth_basic_model['password'] = 'testString' + replication_database_auth_basic_model['username'] = 'testString' + + # Construct a dict representation of a ReplicationDatabaseAuthIam model + replication_database_auth_iam_model = {} + replication_database_auth_iam_model['api_key'] = 'testString' + + # Construct a dict representation of a ReplicationDatabaseAuth model + replication_database_auth_model = {} + replication_database_auth_model['basic'] = replication_database_auth_basic_model + replication_database_auth_model['iam'] = replication_database_auth_iam_model + + # Construct a dict representation of a ReplicationDatabase model + replication_database_model = {} + replication_database_model['auth'] = replication_database_auth_model + replication_database_model['headers'] = {'key1': 'testString'} + replication_database_model['url'] = 'https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb' + + # Construct a dict representation of a UserContext model + user_context_model = {} + user_context_model['db'] = 'testString' + user_context_model['name'] = 'john' + user_context_model['roles'] = ['_replicator'] + + # Construct a dict representation of a ReplicationDocument model + replication_document_model = {} + replication_document_model['_attachments'] = {'key1': attachment_model} + replication_document_model['_conflicts'] = ['testString'] + replication_document_model['_deleted'] = True + replication_document_model['_deleted_conflicts'] = ['testString'] + replication_document_model['_id'] = 'testString' + replication_document_model['_local_seq'] = 'testString' + replication_document_model['_rev'] = 'testString' + replication_document_model['_revisions'] = revisions_model + replication_document_model['_revs_info'] = [document_revision_status_model] + replication_document_model['cancel'] = False + replication_document_model['checkpoint_interval'] = 4500 + replication_document_model['connection_timeout'] = 15000 + replication_document_model['continuous'] = True + replication_document_model['create_target'] = True + replication_document_model['create_target_params'] = replication_create_target_parameters_model + replication_document_model['doc_ids'] = ['badger', 'lemur', 'llama'] + replication_document_model['filter'] = 'ddoc/my_filter' + replication_document_model['http_connections'] = 10 + replication_document_model['owner'] = 'testString' + replication_document_model['query_params'] = {'key1': 'testString'} + replication_document_model['retries_per_request'] = 3 + replication_document_model['selector'] = {'_id': {'$regex': 'docid'}} + replication_document_model['since_seq'] = '34-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdU' + replication_document_model['socket_options'] = '[{keepalive, true}, {nodelay, false}]' + replication_document_model['source'] = replication_database_model + replication_document_model['source_proxy'] = 'testString' + replication_document_model['target'] = replication_database_model + replication_document_model['target_proxy'] = 'testString' + replication_document_model['use_bulk_get'] = True + replication_document_model['use_checkpoints'] = False + replication_document_model['user_ctx'] = user_context_model + replication_document_model['winning_revs_only'] = False + replication_document_model['worker_batch_size'] = 400 + replication_document_model['worker_processes'] = 3 + replication_document_model['foo'] = 'testString' + + # Set up parameter values + replication_document = replication_document_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "replication_document": replication_document, + } + 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.post_replicator(**req_copy) + + def test_post_replicator_value_error_with_retries(self): + # Enable retries and run test_post_replicator_value_error. + _service.enable_retries() + self.test_post_replicator_value_error() + + # Disable retries and run test_post_replicator_value_error. + _service.disable_retries() + self.test_post_replicator_value_error() + + +class TestDeleteReplicationDocument: + """ + Test Class for delete_replication_document + """ + + @responses.activate + def test_delete_replication_document_all_params(self): + """ + delete_replication_document() + """ + # Set up mock + url = preprocess_url('/_replicator/testString') + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + doc_id = 'testString' + if_match = 'testString' + batch = 'ok' + rev = 'testString' + + # Invoke method + response = _service.delete_replication_document( + doc_id, + if_match=if_match, + batch=batch, + rev=rev, + 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 'batch={}'.format(batch) in query_string + assert 'rev={}'.format(rev) in query_string + + def test_delete_replication_document_all_params_with_retries(self): + # Enable retries and run test_delete_replication_document_all_params. + _service.enable_retries() + self.test_delete_replication_document_all_params() + + # Disable retries and run test_delete_replication_document_all_params. + _service.disable_retries() + self.test_delete_replication_document_all_params() + + @responses.activate + def test_delete_replication_document_required_params(self): + """ + test_delete_replication_document_required_params() + """ + # Set up mock + url = preprocess_url('/_replicator/testString') + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + doc_id = 'testString' + + # Invoke method + response = _service.delete_replication_document( + doc_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 assert response.status_code == 200 def test_delete_replication_document_required_params_with_retries(self): @@ -9581,7 +9996,7 @@ def test_delete_replication_document_value_error(self): """ # Set up mock url = preprocess_url('/_replicator/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -9624,7 +10039,7 @@ def test_get_replication_document_all_params(self): """ # Set up mock url = preprocess_url('/_replicator/testString') - mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "cancel": true, "checkpoint_interval": 30000, "connection_timeout": 30000, "continuous": false, "create_target": false, "create_target_params": {"n": 3, "partitioned": false, "q": 1}, "doc_ids": ["doc_ids"], "filter": "filter", "http_connections": 20, "owner": "owner", "query_params": {"mapKey": "inner"}, "retries_per_request": 5, "selector": {"anyKey": "anyValue"}, "since_seq": "since_seq", "socket_options": "socket_options", "source": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "source_proxy": "source_proxy", "target": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "target_proxy": "target_proxy", "use_bulk_get": true, "use_checkpoints": true, "user_ctx": {"db": "db", "name": "name", "roles": ["_reader"]}, "winning_revs_only": false, "worker_batch_size": 500, "worker_processes": 4}' + mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "cancel": true, "checkpoint_interval": 30000, "connection_timeout": 30000, "continuous": false, "create_target": false, "create_target_params": {"n": 3, "partitioned": false, "q": 16}, "doc_ids": ["doc_ids"], "filter": "filter", "http_connections": 20, "owner": "owner", "query_params": {"mapKey": "inner"}, "retries_per_request": 5, "selector": {"anyKey": "anyValue"}, "since_seq": "since_seq", "socket_options": "socket_options", "source": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "source_proxy": "source_proxy", "target": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "target_proxy": "target_proxy", "use_bulk_get": true, "use_checkpoints": true, "user_ctx": {"db": "db", "name": "name", "roles": ["_reader"]}, "winning_revs_only": false, "worker_batch_size": 500, "worker_processes": 4}' responses.add( responses.GET, url, @@ -9697,7 +10112,7 @@ def test_get_replication_document_required_params(self): """ # Set up mock url = preprocess_url('/_replicator/testString') - mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "cancel": true, "checkpoint_interval": 30000, "connection_timeout": 30000, "continuous": false, "create_target": false, "create_target_params": {"n": 3, "partitioned": false, "q": 1}, "doc_ids": ["doc_ids"], "filter": "filter", "http_connections": 20, "owner": "owner", "query_params": {"mapKey": "inner"}, "retries_per_request": 5, "selector": {"anyKey": "anyValue"}, "since_seq": "since_seq", "socket_options": "socket_options", "source": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "source_proxy": "source_proxy", "target": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "target_proxy": "target_proxy", "use_bulk_get": true, "use_checkpoints": true, "user_ctx": {"db": "db", "name": "name", "roles": ["_reader"]}, "winning_revs_only": false, "worker_batch_size": 500, "worker_processes": 4}' + mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "cancel": true, "checkpoint_interval": 30000, "connection_timeout": 30000, "continuous": false, "create_target": false, "create_target_params": {"n": 3, "partitioned": false, "q": 16}, "doc_ids": ["doc_ids"], "filter": "filter", "http_connections": 20, "owner": "owner", "query_params": {"mapKey": "inner"}, "retries_per_request": 5, "selector": {"anyKey": "anyValue"}, "since_seq": "since_seq", "socket_options": "socket_options", "source": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "source_proxy": "source_proxy", "target": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "target_proxy": "target_proxy", "use_bulk_get": true, "use_checkpoints": true, "user_ctx": {"db": "db", "name": "name", "roles": ["_reader"]}, "winning_revs_only": false, "worker_batch_size": 500, "worker_processes": 4}' responses.add( responses.GET, url, @@ -9735,7 +10150,7 @@ def test_get_replication_document_value_error(self): """ # Set up mock url = preprocess_url('/_replicator/testString') - mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "cancel": true, "checkpoint_interval": 30000, "connection_timeout": 30000, "continuous": false, "create_target": false, "create_target_params": {"n": 3, "partitioned": false, "q": 1}, "doc_ids": ["doc_ids"], "filter": "filter", "http_connections": 20, "owner": "owner", "query_params": {"mapKey": "inner"}, "retries_per_request": 5, "selector": {"anyKey": "anyValue"}, "since_seq": "since_seq", "socket_options": "socket_options", "source": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "source_proxy": "source_proxy", "target": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "target_proxy": "target_proxy", "use_bulk_get": true, "use_checkpoints": true, "user_ctx": {"db": "db", "name": "name", "roles": ["_reader"]}, "winning_revs_only": false, "worker_batch_size": 500, "worker_processes": 4}' + mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "cancel": true, "checkpoint_interval": 30000, "connection_timeout": 30000, "continuous": false, "create_target": false, "create_target_params": {"n": 3, "partitioned": false, "q": 16}, "doc_ids": ["doc_ids"], "filter": "filter", "http_connections": 20, "owner": "owner", "query_params": {"mapKey": "inner"}, "retries_per_request": 5, "selector": {"anyKey": "anyValue"}, "since_seq": "since_seq", "socket_options": "socket_options", "source": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "source_proxy": "source_proxy", "target": {"auth": {"basic": {"password": "password", "username": "username"}, "iam": {"api_key": "api_key"}}, "headers": {"mapKey": "inner"}, "url": "url"}, "target_proxy": "target_proxy", "use_bulk_get": true, "use_checkpoints": true, "user_ctx": {"db": "db", "name": "name", "roles": ["_reader"]}, "winning_revs_only": false, "worker_batch_size": 500, "worker_processes": 4}' responses.add( responses.GET, url, @@ -9778,7 +10193,7 @@ def test_put_replication_document_all_params(self): """ # Set up mock url = preprocess_url('/_replicator/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -9931,7 +10346,7 @@ def test_put_replication_document_required_params(self): """ # Set up mock url = preprocess_url('/_replicator/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -10070,7 +10485,7 @@ def test_put_replication_document_value_error(self): """ # Set up mock url = preprocess_url('/_replicator/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -10642,99 +11057,56 @@ def test_new_instance_without_authenticator(self): ) -class TestGetSecurity: +class TestPostApiKeys: """ - Test Class for get_security + Test Class for post_api_keys """ @responses.activate - def test_get_security_all_params(self): + def test_post_api_keys_all_params(self): """ - get_security() + post_api_keys() """ # Set up mock - url = preprocess_url('/testString/_security') - mock_response = '{"admins": {"names": ["names"], "roles": ["roles"]}, "members": {"names": ["names"], "roles": ["roles"]}, "cloudant": {"mapKey": ["_reader"]}, "couchdb_auth_only": false}' + url = preprocess_url('/_api/v2/api_keys') + mock_response = '{"ok": true, "key": "key", "password": "password"}' responses.add( - responses.GET, + responses.POST, url, body=mock_response, content_type='application/json', - status=200, + status=201, ) - # Set up parameter values - db = 'testString' - # Invoke method - response = _service.get_security( - db, - headers={}, - ) + response = _service.post_api_keys() # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_get_security_all_params_with_retries(self): - # Enable retries and run test_get_security_all_params. - _service.enable_retries() - self.test_get_security_all_params() - - # Disable retries and run test_get_security_all_params. - _service.disable_retries() - self.test_get_security_all_params() - - @responses.activate - def test_get_security_value_error(self): - """ - test_get_security_value_error() - """ - # Set up mock - url = preprocess_url('/testString/_security') - mock_response = '{"admins": {"names": ["names"], "roles": ["roles"]}, "members": {"names": ["names"], "roles": ["roles"]}, "cloudant": {"mapKey": ["_reader"]}, "couchdb_auth_only": false}' - responses.add( - responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200, - ) - - # Set up parameter values - db = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "db": db, - } - 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_security(**req_copy) + assert response.status_code == 201 - def test_get_security_value_error_with_retries(self): - # Enable retries and run test_get_security_value_error. + def test_post_api_keys_all_params_with_retries(self): + # Enable retries and run test_post_api_keys_all_params. _service.enable_retries() - self.test_get_security_value_error() + self.test_post_api_keys_all_params() - # Disable retries and run test_get_security_value_error. + # Disable retries and run test_post_api_keys_all_params. _service.disable_retries() - self.test_get_security_value_error() + self.test_post_api_keys_all_params() -class TestPutSecurity: +class TestPutCloudantSecurityConfiguration: """ - Test Class for put_security + Test Class for put_cloudant_security_configuration """ @responses.activate - def test_put_security_all_params(self): + def test_put_cloudant_security_configuration_all_params(self): """ - put_security() + put_cloudant_security_configuration() """ # Set up mock - url = preprocess_url('/testString/_security') + url = preprocess_url('/_api/v2/db/testString/_security') mock_response = '{"ok": true}' responses.add( responses.PUT, @@ -10746,23 +11118,23 @@ def test_put_security_all_params(self): # Construct a dict representation of a SecurityObject model security_object_model = {} - security_object_model['names'] = ['superuser'] - security_object_model['roles'] = ['admins'] + security_object_model['names'] = ['testString'] + security_object_model['roles'] = ['testString'] # Set up parameter values db = 'testString' - admins = security_object_model - members = security_object_model cloudant = {'key1': ['_reader']} + admins = security_object_model couchdb_auth_only = True + members = security_object_model # Invoke method - response = _service.put_security( + response = _service.put_cloudant_security_configuration( db, + cloudant, admins=admins, - members=members, - cloudant=cloudant, couchdb_auth_only=couchdb_auth_only, + members=members, headers={}, ) @@ -10775,27 +11147,27 @@ def test_put_security_all_params(self): # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['admins'] == security_object_model - assert req_body['members'] == security_object_model assert req_body['cloudant'] == {'key1': ['_reader']} + assert req_body['admins'] == security_object_model assert req_body['couchdb_auth_only'] == True + assert req_body['members'] == security_object_model - def test_put_security_all_params_with_retries(self): - # Enable retries and run test_put_security_all_params. + def test_put_cloudant_security_configuration_all_params_with_retries(self): + # Enable retries and run test_put_cloudant_security_configuration_all_params. _service.enable_retries() - self.test_put_security_all_params() + self.test_put_cloudant_security_configuration_all_params() - # Disable retries and run test_put_security_all_params. + # Disable retries and run test_put_cloudant_security_configuration_all_params. _service.disable_retries() - self.test_put_security_all_params() + self.test_put_cloudant_security_configuration_all_params() @responses.activate - def test_put_security_value_error(self): + def test_put_cloudant_security_configuration_value_error(self): """ - test_put_security_value_error() + test_put_cloudant_security_configuration_value_error() """ # Set up mock - url = preprocess_url('/testString/_security') + url = preprocess_url('/_api/v2/db/testString/_security') mock_response = '{"ok": true}' responses.add( responses.PUT, @@ -10807,85 +11179,129 @@ def test_put_security_value_error(self): # Construct a dict representation of a SecurityObject model security_object_model = {} - security_object_model['names'] = ['superuser'] - security_object_model['roles'] = ['admins'] + security_object_model['names'] = ['testString'] + security_object_model['roles'] = ['testString'] # Set up parameter values db = 'testString' - admins = security_object_model - members = security_object_model cloudant = {'key1': ['_reader']} + admins = security_object_model couchdb_auth_only = True + members = security_object_model # Pass in all but one required param and check for a ValueError req_param_dict = { "db": db, + "cloudant": cloudant, } 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.put_security(**req_copy) + _service.put_cloudant_security_configuration(**req_copy) - def test_put_security_value_error_with_retries(self): - # Enable retries and run test_put_security_value_error. + def test_put_cloudant_security_configuration_value_error_with_retries(self): + # Enable retries and run test_put_cloudant_security_configuration_value_error. _service.enable_retries() - self.test_put_security_value_error() + self.test_put_cloudant_security_configuration_value_error() - # Disable retries and run test_put_security_value_error. + # Disable retries and run test_put_cloudant_security_configuration_value_error. _service.disable_retries() - self.test_put_security_value_error() + self.test_put_cloudant_security_configuration_value_error() -class TestPostApiKeys: +class TestGetSecurity: """ - Test Class for post_api_keys + Test Class for get_security """ @responses.activate - def test_post_api_keys_all_params(self): + def test_get_security_all_params(self): """ - post_api_keys() + get_security() """ # Set up mock - url = preprocess_url('/_api/v2/api_keys') - mock_response = '{"ok": true, "key": "key", "password": "password"}' + url = preprocess_url('/testString/_security') + mock_response = '{"admins": {"names": ["names"], "roles": ["roles"]}, "cloudant": {"mapKey": ["_reader"]}, "couchdb_auth_only": false, "members": {"names": ["names"], "roles": ["roles"]}}' responses.add( - responses.POST, + responses.GET, url, body=mock_response, content_type='application/json', - status=201, + status=200, ) + # Set up parameter values + db = 'testString' + # Invoke method - response = _service.post_api_keys() + response = _service.get_security( + db, + headers={}, + ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 201 + assert response.status_code == 200 + + def test_get_security_all_params_with_retries(self): + # Enable retries and run test_get_security_all_params. + _service.enable_retries() + self.test_get_security_all_params() + + # Disable retries and run test_get_security_all_params. + _service.disable_retries() + self.test_get_security_all_params() + + @responses.activate + def test_get_security_value_error(self): + """ + test_get_security_value_error() + """ + # Set up mock + url = preprocess_url('/testString/_security') + mock_response = '{"admins": {"names": ["names"], "roles": ["roles"]}, "cloudant": {"mapKey": ["_reader"]}, "couchdb_auth_only": false, "members": {"names": ["names"], "roles": ["roles"]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + db = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "db": db, + } + 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_security(**req_copy) - def test_post_api_keys_all_params_with_retries(self): - # Enable retries and run test_post_api_keys_all_params. + def test_get_security_value_error_with_retries(self): + # Enable retries and run test_get_security_value_error. _service.enable_retries() - self.test_post_api_keys_all_params() + self.test_get_security_value_error() - # Disable retries and run test_post_api_keys_all_params. + # Disable retries and run test_get_security_value_error. _service.disable_retries() - self.test_post_api_keys_all_params() + self.test_get_security_value_error() -class TestPutCloudantSecurityConfiguration: +class TestPutSecurity: """ - Test Class for put_cloudant_security_configuration + Test Class for put_security """ @responses.activate - def test_put_cloudant_security_configuration_all_params(self): + def test_put_security_all_params(self): """ - put_cloudant_security_configuration() + put_security() """ # Set up mock - url = preprocess_url('/_api/v2/db/testString/_security') + url = preprocess_url('/testString/_security') mock_response = '{"ok": true}' responses.add( responses.PUT, @@ -10897,23 +11313,23 @@ def test_put_cloudant_security_configuration_all_params(self): # Construct a dict representation of a SecurityObject model security_object_model = {} - security_object_model['names'] = ['testString'] - security_object_model['roles'] = ['testString'] + security_object_model['names'] = ['superuser'] + security_object_model['roles'] = ['admins'] # Set up parameter values db = 'testString' - cloudant = {'key1': ['_reader']} admins = security_object_model - members = security_object_model + cloudant = {'key1': ['_reader']} couchdb_auth_only = True + members = security_object_model # Invoke method - response = _service.put_cloudant_security_configuration( + response = _service.put_security( db, - cloudant, admins=admins, - members=members, + cloudant=cloudant, couchdb_auth_only=couchdb_auth_only, + members=members, headers={}, ) @@ -10926,27 +11342,27 @@ def test_put_cloudant_security_configuration_all_params(self): # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['cloudant'] == {'key1': ['_reader']} assert req_body['admins'] == security_object_model - assert req_body['members'] == security_object_model + assert req_body['cloudant'] == {'key1': ['_reader']} assert req_body['couchdb_auth_only'] == True + assert req_body['members'] == security_object_model - def test_put_cloudant_security_configuration_all_params_with_retries(self): - # Enable retries and run test_put_cloudant_security_configuration_all_params. + def test_put_security_all_params_with_retries(self): + # Enable retries and run test_put_security_all_params. _service.enable_retries() - self.test_put_cloudant_security_configuration_all_params() + self.test_put_security_all_params() - # Disable retries and run test_put_cloudant_security_configuration_all_params. + # Disable retries and run test_put_security_all_params. _service.disable_retries() - self.test_put_cloudant_security_configuration_all_params() + self.test_put_security_all_params() @responses.activate - def test_put_cloudant_security_configuration_value_error(self): + def test_put_security_value_error(self): """ - test_put_cloudant_security_configuration_value_error() + test_put_security_value_error() """ # Set up mock - url = preprocess_url('/_api/v2/db/testString/_security') + url = preprocess_url('/testString/_security') mock_response = '{"ok": true}' responses.add( responses.PUT, @@ -10958,34 +11374,33 @@ def test_put_cloudant_security_configuration_value_error(self): # Construct a dict representation of a SecurityObject model security_object_model = {} - security_object_model['names'] = ['testString'] - security_object_model['roles'] = ['testString'] + security_object_model['names'] = ['superuser'] + security_object_model['roles'] = ['admins'] # Set up parameter values db = 'testString' - cloudant = {'key1': ['_reader']} admins = security_object_model - members = security_object_model + cloudant = {'key1': ['_reader']} couchdb_auth_only = True + members = security_object_model # Pass in all but one required param and check for a ValueError req_param_dict = { "db": db, - "cloudant": cloudant, } 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.put_cloudant_security_configuration(**req_copy) + _service.put_security(**req_copy) - def test_put_cloudant_security_configuration_value_error_with_retries(self): - # Enable retries and run test_put_cloudant_security_configuration_value_error. + def test_put_security_value_error_with_retries(self): + # Enable retries and run test_put_security_value_error. _service.enable_retries() - self.test_put_cloudant_security_configuration_value_error() + self.test_put_security_value_error() - # Disable retries and run test_put_cloudant_security_configuration_value_error. + # Disable retries and run test_put_security_value_error. _service.disable_retries() - self.test_put_cloudant_security_configuration_value_error() + self.test_put_security_value_error() # endregion @@ -11344,7 +11759,7 @@ def test_delete_attachment_all_params(self): """ # Set up mock url = preprocess_url('/testString/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -11397,7 +11812,7 @@ def test_delete_attachment_required_params(self): """ # Set up mock url = preprocess_url('/testString/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -11439,7 +11854,7 @@ def test_delete_attachment_value_error(self): """ # Set up mock url = preprocess_url('/testString/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -11629,7 +12044,7 @@ def test_put_attachment_all_params(self): """ # Set up mock url = preprocess_url('/testString/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -11688,7 +12103,7 @@ def test_put_attachment_required_params(self): """ # Set up mock url = preprocess_url('/testString/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -11739,7 +12154,7 @@ def test_put_attachment_value_error(self): """ # Set up mock url = preprocess_url('/testString/testString/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -11947,7 +12362,7 @@ def test_delete_local_document_all_params(self): """ # Set up mock url = preprocess_url('/testString/_local/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -11993,7 +12408,7 @@ def test_delete_local_document_required_params(self): """ # Set up mock url = preprocess_url('/testString/_local/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -12033,7 +12448,7 @@ def test_delete_local_document_value_error(self): """ # Set up mock url = preprocess_url('/testString/_local/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.DELETE, url, @@ -12219,7 +12634,7 @@ def test_put_local_document_all_params(self): """ # Set up mock url = preprocess_url('/testString/_local/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -12318,7 +12733,7 @@ def test_put_local_document_required_params(self): """ # Set up mock url = preprocess_url('/testString/_local/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -12409,7 +12824,7 @@ def test_put_local_document_value_error(self): """ # Set up mock url = preprocess_url('/testString/_local/testString') - mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 3}' + mock_response = '{"id": "id", "rev": "rev", "ok": true, "caused_by": "caused_by", "error": "error", "reason": "reason", "ref": 0}' responses.add( responses.PUT, url, @@ -12897,82 +13312,6 @@ def test_get_active_tasks_all_params_with_retries(self): self.test_get_active_tasks_all_params() -class TestGetMembershipInformation: - """ - Test Class for get_membership_information - """ - - @responses.activate - def test_get_membership_information_all_params(self): - """ - get_membership_information() - """ - # Set up mock - url = preprocess_url('/_membership') - mock_response = '{"all_nodes": ["all_nodes"], "cluster_nodes": ["cluster_nodes"]}' - responses.add( - responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200, - ) - - # Invoke method - response = _service.get_membership_information() - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_get_membership_information_all_params_with_retries(self): - # Enable retries and run test_get_membership_information_all_params. - _service.enable_retries() - self.test_get_membership_information_all_params() - - # Disable retries and run test_get_membership_information_all_params. - _service.disable_retries() - self.test_get_membership_information_all_params() - - -class TestGetUpInformation: - """ - Test Class for get_up_information - """ - - @responses.activate - def test_get_up_information_all_params(self): - """ - get_up_information() - """ - # Set up mock - url = preprocess_url('/_up') - mock_response = '{"seeds": {"anyKey": "anyValue"}, "status": "maintenance_mode"}' - responses.add( - responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200, - ) - - # Invoke method - response = _service.get_up_information() - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_get_up_information_all_params_with_retries(self): - # Enable retries and run test_get_up_information_all_params. - _service.enable_retries() - self.test_get_up_information_all_params() - - # Disable retries and run test_get_up_information_all_params. - _service.disable_retries() - self.test_get_up_information_all_params() - - class TestGetActivityTrackerEvents: """ Test Class for get_activity_tracker_events @@ -13137,6 +13476,82 @@ def test_get_current_throughput_information_all_params_with_retries(self): self.test_get_current_throughput_information_all_params() +class TestGetMembershipInformation: + """ + Test Class for get_membership_information + """ + + @responses.activate + def test_get_membership_information_all_params(self): + """ + get_membership_information() + """ + # Set up mock + url = preprocess_url('/_membership') + mock_response = '{"all_nodes": ["all_nodes"], "cluster_nodes": ["cluster_nodes"]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Invoke method + response = _service.get_membership_information() + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_membership_information_all_params_with_retries(self): + # Enable retries and run test_get_membership_information_all_params. + _service.enable_retries() + self.test_get_membership_information_all_params() + + # Disable retries and run test_get_membership_information_all_params. + _service.disable_retries() + self.test_get_membership_information_all_params() + + +class TestGetUpInformation: + """ + Test Class for get_up_information + """ + + @responses.activate + def test_get_up_information_all_params(self): + """ + get_up_information() + """ + # Set up mock + url = preprocess_url('/_up') + mock_response = '{"seeds": {"anyKey": "anyValue"}, "status": "maintenance_mode"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Invoke method + response = _service.get_up_information() + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_up_information_all_params_with_retries(self): + # Enable retries and run test_get_up_information_all_params. + _service.enable_retries() + self.test_get_up_information_all_params() + + # Disable retries and run test_get_up_information_all_params. + _service.disable_retries() + self.test_get_up_information_all_params() + + # endregion ############################################################################## # End of Service: Monitoring @@ -13293,7 +13708,7 @@ def test_all_docs_queries_result_serialization(self): docs_result_row_model['caused_by'] = 'testString' docs_result_row_model['error'] = 'testString' docs_result_row_model['reason'] = 'testString' - docs_result_row_model['ref'] = 26 + docs_result_row_model['ref'] = 0 docs_result_row_model['doc'] = document_model docs_result_row_model['id'] = 'testString' docs_result_row_model['key'] = 'testString' @@ -13417,7 +13832,7 @@ def test_all_docs_result_serialization(self): docs_result_row_model['caused_by'] = 'testString' docs_result_row_model['error'] = 'testString' docs_result_row_model['reason'] = 'testString' - docs_result_row_model['ref'] = 26 + docs_result_row_model['ref'] = 0 docs_result_row_model['doc'] = document_model docs_result_row_model['id'] = 'testString' docs_result_row_model['key'] = 'testString' @@ -13699,7 +14114,7 @@ def test_bulk_get_result_serialization(self): document_result_model['caused_by'] = 'testString' document_result_model['error'] = 'testString' document_result_model['reason'] = 'testString' - document_result_model['ref'] = 26 + document_result_model['ref'] = 0 attachment_model = {} # Attachment attachment_model['content_type'] = 'testString' @@ -13779,7 +14194,7 @@ def test_bulk_get_result_document_serialization(self): document_result_model['caused_by'] = 'testString' document_result_model['error'] = 'testString' document_result_model['reason'] = 'testString' - document_result_model['ref'] = 26 + document_result_model['ref'] = 0 attachment_model = {} # Attachment attachment_model['content_type'] = 'testString' @@ -13852,7 +14267,7 @@ def test_bulk_get_result_item_serialization(self): document_result_model['caused_by'] = 'testString' document_result_model['error'] = 'testString' document_result_model['reason'] = 'testString' - document_result_model['ref'] = 26 + document_result_model['ref'] = 0 attachment_model = {} # Attachment attachment_model['content_type'] = 'testString' @@ -14117,7 +14532,7 @@ def test_changes_result_serialization(self): # Construct a json representation of a ChangesResult model changes_result_model_json = {} changes_result_model_json['last_seq'] = 'testString' - changes_result_model_json['pending'] = 26 + changes_result_model_json['pending'] = 0 changes_result_model_json['results'] = [changes_result_item_model] # Construct a model instance of ChangesResult by calling from_dict on the json representation @@ -14218,9 +14633,9 @@ def test_content_information_sizes_serialization(self): # Construct a json representation of a ContentInformationSizes model content_information_sizes_model_json = {} - content_information_sizes_model_json['active'] = 26 - content_information_sizes_model_json['external'] = 26 - content_information_sizes_model_json['file'] = 26 + content_information_sizes_model_json['active'] = 0 + content_information_sizes_model_json['external'] = 0 + content_information_sizes_model_json['file'] = 0 # Construct a model instance of ContentInformationSizes by calling from_dict on the json representation content_information_sizes_model = ContentInformationSizes.from_dict(content_information_sizes_model_json) @@ -14353,18 +14768,10 @@ def test_database_information_serialization(self): database_information_cluster_model = {} # DatabaseInformationCluster database_information_cluster_model['n'] = 3 - database_information_cluster_model['q'] = 26 + database_information_cluster_model['q'] = 16 database_information_cluster_model['r'] = 1 database_information_cluster_model['w'] = 1 - database_information_props_model = {} # DatabaseInformationProps - database_information_props_model['partitioned'] = True - - content_information_sizes_model = {} # ContentInformationSizes - content_information_sizes_model['active'] = 26 - content_information_sizes_model['external'] = 26 - content_information_sizes_model['file'] = 26 - partitioned_indexes_detailed_information_model = {} # PartitionedIndexesDetailedInformation partitioned_indexes_detailed_information_model['search'] = 0 partitioned_indexes_detailed_information_model['view'] = 0 @@ -14374,6 +14781,14 @@ def test_database_information_serialization(self): partitioned_indexes_information_model['indexes'] = partitioned_indexes_detailed_information_model partitioned_indexes_information_model['limit'] = 10 + database_information_props_model = {} # DatabaseInformationProps + database_information_props_model['partitioned'] = True + + content_information_sizes_model = {} # ContentInformationSizes + content_information_sizes_model['active'] = 0 + content_information_sizes_model['external'] = 0 + content_information_sizes_model['file'] = 0 + # Construct a json representation of a DatabaseInformation model database_information_model_json = {} database_information_model_json['cluster'] = database_information_cluster_model @@ -14381,16 +14796,16 @@ def test_database_information_serialization(self): database_information_model_json['compact_running'] = True database_information_model_json['compacted_seq'] = 'testString' database_information_model_json['db_name'] = 'testString' - database_information_model_json['disk_format_version'] = 26 + database_information_model_json['disk_format_version'] = 1 database_information_model_json['doc_count'] = 0 database_information_model_json['doc_del_count'] = 0 database_information_model_json['engine'] = 'testString' database_information_model_json['instance_start_time'] = 'testString' + database_information_model_json['partitioned_indexes'] = partitioned_indexes_information_model database_information_model_json['props'] = database_information_props_model database_information_model_json['sizes'] = content_information_sizes_model database_information_model_json['update_seq'] = 'testString' database_information_model_json['uuid'] = 'testString' - database_information_model_json['partitioned_indexes'] = partitioned_indexes_information_model # Construct a model instance of DatabaseInformation by calling from_dict on the json representation database_information_model = DatabaseInformation.from_dict(database_information_model_json) @@ -14421,7 +14836,7 @@ def test_database_information_cluster_serialization(self): # Construct a json representation of a DatabaseInformationCluster model database_information_cluster_model_json = {} database_information_cluster_model_json['n'] = 3 - database_information_cluster_model_json['q'] = 26 + database_information_cluster_model_json['q'] = 16 database_information_cluster_model_json['r'] = 1 database_information_cluster_model_json['w'] = 1 @@ -14555,18 +14970,10 @@ def test_dbs_info_result_serialization(self): database_information_cluster_model = {} # DatabaseInformationCluster database_information_cluster_model['n'] = 3 - database_information_cluster_model['q'] = 26 + database_information_cluster_model['q'] = 16 database_information_cluster_model['r'] = 1 database_information_cluster_model['w'] = 1 - database_information_props_model = {} # DatabaseInformationProps - database_information_props_model['partitioned'] = True - - content_information_sizes_model = {} # ContentInformationSizes - content_information_sizes_model['active'] = 26 - content_information_sizes_model['external'] = 26 - content_information_sizes_model['file'] = 26 - partitioned_indexes_detailed_information_model = {} # PartitionedIndexesDetailedInformation partitioned_indexes_detailed_information_model['search'] = 0 partitioned_indexes_detailed_information_model['view'] = 0 @@ -14576,22 +14983,30 @@ def test_dbs_info_result_serialization(self): partitioned_indexes_information_model['indexes'] = partitioned_indexes_detailed_information_model partitioned_indexes_information_model['limit'] = 10 + database_information_props_model = {} # DatabaseInformationProps + database_information_props_model['partitioned'] = True + + content_information_sizes_model = {} # ContentInformationSizes + content_information_sizes_model['active'] = 0 + content_information_sizes_model['external'] = 0 + content_information_sizes_model['file'] = 0 + database_information_model = {} # DatabaseInformation database_information_model['cluster'] = database_information_cluster_model database_information_model['committed_update_seq'] = 'testString' database_information_model['compact_running'] = True database_information_model['compacted_seq'] = 'testString' database_information_model['db_name'] = 'testString' - database_information_model['disk_format_version'] = 26 + database_information_model['disk_format_version'] = 1 database_information_model['doc_count'] = 0 database_information_model['doc_del_count'] = 0 database_information_model['engine'] = 'testString' database_information_model['instance_start_time'] = 'testString' + database_information_model['partitioned_indexes'] = partitioned_indexes_information_model database_information_model['props'] = database_information_props_model database_information_model['sizes'] = content_information_sizes_model database_information_model['update_seq'] = 'testString' database_information_model['uuid'] = 'testString' - database_information_model['partitioned_indexes'] = partitioned_indexes_information_model # Construct a json representation of a DbsInfoResult model dbs_info_result_model_json = {} @@ -14725,14 +15140,14 @@ def test_design_document_information_serialization(self): # Construct dict forms of any model objects needed in order to build this model. content_information_sizes_model = {} # ContentInformationSizes - content_information_sizes_model['active'] = 26 - content_information_sizes_model['external'] = 26 - content_information_sizes_model['file'] = 26 + content_information_sizes_model['active'] = 0 + content_information_sizes_model['external'] = 0 + content_information_sizes_model['file'] = 0 updates_pending_model = {} # UpdatesPending - updates_pending_model['minimum'] = 26 - updates_pending_model['preferred'] = 26 - updates_pending_model['total'] = 26 + updates_pending_model['minimum'] = 0 + updates_pending_model['preferred'] = 0 + updates_pending_model['total'] = 0 design_document_view_index_model = {} # DesignDocumentViewIndex design_document_view_index_model['collator_versions'] = ['testString'] @@ -14809,14 +15224,14 @@ def test_design_document_view_index_serialization(self): # Construct dict forms of any model objects needed in order to build this model. content_information_sizes_model = {} # ContentInformationSizes - content_information_sizes_model['active'] = 26 - content_information_sizes_model['external'] = 26 - content_information_sizes_model['file'] = 26 + content_information_sizes_model['active'] = 0 + content_information_sizes_model['external'] = 0 + content_information_sizes_model['file'] = 0 updates_pending_model = {} # UpdatesPending - updates_pending_model['minimum'] = 26 - updates_pending_model['preferred'] = 26 - updates_pending_model['total'] = 26 + updates_pending_model['minimum'] = 0 + updates_pending_model['preferred'] = 0 + updates_pending_model['total'] = 0 # Construct a json representation of a DesignDocumentViewIndex model design_document_view_index_model_json = {} @@ -14929,7 +15344,7 @@ def test_docs_result_row_serialization(self): docs_result_row_model_json['caused_by'] = 'testString' docs_result_row_model_json['error'] = 'testString' docs_result_row_model_json['reason'] = 'testString' - docs_result_row_model_json['ref'] = 26 + docs_result_row_model_json['ref'] = 0 docs_result_row_model_json['doc'] = document_model docs_result_row_model_json['id'] = 'testString' docs_result_row_model_json['key'] = 'testString' @@ -15070,7 +15485,7 @@ def test_document_result_serialization(self): document_result_model_json['caused_by'] = 'testString' document_result_model_json['error'] = 'testString' document_result_model_json['reason'] = 'testString' - document_result_model_json['ref'] = 26 + document_result_model_json['ref'] = 0 # Construct a model instance of DocumentResult by calling from_dict on the json representation document_result_model = DocumentResult.from_dict(document_result_model_json) @@ -15238,7 +15653,7 @@ def test_explain_result_serialization(self): explain_result_mr_args_model = {} # ExplainResultMrArgs explain_result_mr_args_model['conflicts'] = 'testString' - explain_result_mr_args_model['direction'] = 'asc' + explain_result_mr_args_model['direction'] = 'fwd' explain_result_mr_args_model['end_key'] = 'testString' explain_result_mr_args_model['include_docs'] = True explain_result_mr_args_model['partition'] = 'testString' @@ -15312,7 +15727,7 @@ def test_explain_result_mr_args_serialization(self): # Construct a json representation of a ExplainResultMrArgs model explain_result_mr_args_model_json = {} explain_result_mr_args_model_json['conflicts'] = 'testString' - explain_result_mr_args_model_json['direction'] = 'asc' + explain_result_mr_args_model_json['direction'] = 'fwd' explain_result_mr_args_model_json['end_key'] = 'testString' explain_result_mr_args_model_json['include_docs'] = True explain_result_mr_args_model_json['partition'] = 'testString' @@ -16160,7 +16575,7 @@ def test_replication_create_target_parameters_serialization(self): replication_create_target_parameters_model_json = {} replication_create_target_parameters_model_json['n'] = 3 replication_create_target_parameters_model_json['partitioned'] = False - replication_create_target_parameters_model_json['q'] = 26 + replication_create_target_parameters_model_json['q'] = 16 # Construct a model instance of ReplicationCreateTargetParameters by calling from_dict on the json representation replication_create_target_parameters_model = ReplicationCreateTargetParameters.from_dict(replication_create_target_parameters_model_json) @@ -16358,7 +16773,7 @@ def test_replication_document_serialization(self): replication_create_target_parameters_model = {} # ReplicationCreateTargetParameters replication_create_target_parameters_model['n'] = 3 replication_create_target_parameters_model['partitioned'] = False - replication_create_target_parameters_model['q'] = 26 + replication_create_target_parameters_model['q'] = 16 replication_database_auth_basic_model = {} # ReplicationDatabaseAuthBasic replication_database_auth_basic_model['password'] = 'testString' @@ -16900,11 +17315,11 @@ def test_search_index_info_serialization(self): # Construct a json representation of a SearchIndexInfo model search_index_info_model_json = {} - search_index_info_model_json['committed_seq'] = 26 + search_index_info_model_json['committed_seq'] = 0 search_index_info_model_json['disk_size'] = 0 search_index_info_model_json['doc_count'] = 0 search_index_info_model_json['doc_del_count'] = 0 - search_index_info_model_json['pending_seq'] = 26 + search_index_info_model_json['pending_seq'] = 0 search_index_info_model_json['signature'] = 'testString' # Construct a model instance of SearchIndexInfo by calling from_dict on the json representation @@ -16936,11 +17351,11 @@ def test_search_info_result_serialization(self): # Construct dict forms of any model objects needed in order to build this model. search_index_info_model = {} # SearchIndexInfo - search_index_info_model['committed_seq'] = 26 + search_index_info_model['committed_seq'] = 0 search_index_info_model['disk_size'] = 0 search_index_info_model['doc_count'] = 0 search_index_info_model['doc_del_count'] = 0 - search_index_info_model['pending_seq'] = 26 + search_index_info_model['pending_seq'] = 0 search_index_info_model['signature'] = 'testString' # Construct a json representation of a SearchInfoResult model @@ -17206,9 +17621,9 @@ def test_security_serialization(self): # Construct a json representation of a Security model security_model_json = {} security_model_json['admins'] = security_object_model - security_model_json['members'] = security_object_model security_model_json['cloudant'] = {'key1': ['_reader']} security_model_json['couchdb_auth_only'] = True + security_model_json['members'] = security_object_model # Construct a model instance of Security by calling from_dict on the json representation security_model = Security.from_dict(security_model_json) @@ -17311,9 +17726,9 @@ def test_server_information_serialization(self): server_information_model_json = {} server_information_model_json['couchdb'] = 'testString' server_information_model_json['features'] = ['testString'] + server_information_model_json['features_flags'] = ['testString'] server_information_model_json['vendor'] = server_vendor_model server_information_model_json['version'] = 'testString' - server_information_model_json['features_flags'] = ['testString'] # Construct a model instance of ServerInformation by calling from_dict on the json representation server_information_model = ServerInformation.from_dict(server_information_model_json) @@ -17556,9 +17971,9 @@ def test_updates_pending_serialization(self): # Construct a json representation of a UpdatesPending model updates_pending_model_json = {} - updates_pending_model_json['minimum'] = 26 - updates_pending_model_json['preferred'] = 26 - updates_pending_model_json['total'] = 26 + updates_pending_model_json['minimum'] = 0 + updates_pending_model_json['preferred'] = 0 + updates_pending_model_json['total'] = 0 # Construct a model instance of UpdatesPending by calling from_dict on the json representation updates_pending_model = UpdatesPending.from_dict(updates_pending_model_json) @@ -17685,7 +18100,7 @@ def test_view_queries_result_serialization(self): view_result_row_model['caused_by'] = 'testString' view_result_row_model['error'] = 'testString' view_result_row_model['reason'] = 'testString' - view_result_row_model['ref'] = 26 + view_result_row_model['ref'] = 0 view_result_row_model['doc'] = document_model view_result_row_model['id'] = 'testString' view_result_row_model['key'] = 'testString' @@ -17812,7 +18227,7 @@ def test_view_result_serialization(self): view_result_row_model['caused_by'] = 'testString' view_result_row_model['error'] = 'testString' view_result_row_model['reason'] = 'testString' - view_result_row_model['ref'] = 26 + view_result_row_model['ref'] = 0 view_result_row_model['doc'] = document_model view_result_row_model['id'] = 'testString' view_result_row_model['key'] = 'testString' @@ -17888,7 +18303,7 @@ def test_view_result_row_serialization(self): view_result_row_model_json['caused_by'] = 'testString' view_result_row_model_json['error'] = 'testString' view_result_row_model_json['reason'] = 'testString' - view_result_row_model_json['ref'] = 26 + view_result_row_model_json['ref'] = 0 view_result_row_model_json['doc'] = document_model view_result_row_model_json['id'] = 'testString' view_result_row_model_json['key'] = 'testString'