def list(self, limit=10, offset=0, search=None): """ Retrieves a list of client info structures :param limit: number of result to return (optional, default 10) :param offset: order of first document (optional, default 0) :param search: structured query (optional) can contain: * "match": list of {field, value} Example: { "match": [ {"description": "some search text here"}, {"client_id": "giano"}, ... ], } """ data = json.dumps(search) if search else None query = {'limit': int(limit), 'offset': int(offset)} r = requests.get(self.endpoint, headers=self.headers, params=query, data=data, verify=self.verify) if r.status_code != 200: raise exceptions.ApiClientException(r) return r.json()['clients']
def delete(self, backup_id): endpoint = self.endpoint + backup_id r = requests.delete(endpoint, headers=self.headers, verify=self.verify) if r.status_code != 204: raise exceptions.ApiClientException(r)
def test_get_message_from_response_string(self): e = exceptions.ApiClientException('some error message') self.assertEqual(str(e), 'some error message')