From a28be27205f5c48df5f762ba8399e34c3e965282 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Wed, 20 Nov 2024 21:13:41 +0530 Subject: [PATCH] SK-1731: Fix inconsistencies --- samples/vault_api/invoke_connection.py | 2 +- samples/vault_api/tokenize_records.py | 2 +- skyflow/vault/connection/_invoke_connection_request.py | 4 ++-- skyflow/vault/data/_delete_response.py | 2 +- skyflow/vault/data/_get_response.py | 2 +- skyflow/vault/data/_insert_response.py | 2 +- skyflow/vault/data/_query_response.py | 2 +- skyflow/vault/data/_update_response.py | 2 +- skyflow/vault/tokens/_tokenize_request.py | 4 ++-- tests/vault/controller/test__connection.py | 10 +++++----- tests/vault/controller/test__vault.py | 4 ++-- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/samples/vault_api/invoke_connection.py b/samples/vault_api/invoke_connection.py index a2243fa..f1d7f50 100644 --- a/samples/vault_api/invoke_connection.py +++ b/samples/vault_api/invoke_connection.py @@ -55,7 +55,7 @@ invoke_connection_request = InvokeConnectionRequest( method=Method.POST, body=body, - request_headers=headers, # optional + headers=headers, # optional path_params=path_params, # optional query_params=query_params, # optional ) diff --git a/samples/vault_api/tokenize_records.py b/samples/vault_api/tokenize_records.py index 0ca8e97..3cf3f65 100644 --- a/samples/vault_api/tokenize_records.py +++ b/samples/vault_api/tokenize_records.py @@ -49,7 +49,7 @@ # sample data tokenize_values = [{"": "", "": ""}] -tokenize_request = TokenizeRequest(tokenize_parameters=tokenize_values) +tokenize_request = TokenizeRequest(values=tokenize_values) response = skyflow_client.vault("VAULT_ID").tokenize(tokenize_request) diff --git a/skyflow/vault/connection/_invoke_connection_request.py b/skyflow/vault/connection/_invoke_connection_request.py index 25d9ec0..43a4b08 100644 --- a/skyflow/vault/connection/_invoke_connection_request.py +++ b/skyflow/vault/connection/_invoke_connection_request.py @@ -4,9 +4,9 @@ def __init__(self, body = None, path_params = None, query_params = None, - request_headers = None): + headers = None): self.body = body if body is not None else {} self.method = method self.path_params = path_params if path_params is not None else {} self.query_params = query_params if query_params is not None else {} - self.request_headers = request_headers if request_headers is not None else {} \ No newline at end of file + self.request_headers = headers if headers is not None else {} \ No newline at end of file diff --git a/skyflow/vault/data/_delete_response.py b/skyflow/vault/data/_delete_response.py index ca86624..14934dd 100644 --- a/skyflow/vault/data/_delete_response.py +++ b/skyflow/vault/data/_delete_response.py @@ -4,7 +4,7 @@ def __init__(self, deleted_ids = None, error = None): self.error = error def __repr__(self): - return f"DeleteResponse(deleted_ids={self.deleted_ids}, error={self.error})" + return f"DeleteResponse(deleted_ids={self.deleted_ids}, errors={self.error})" def __str__(self): return self.__repr__() diff --git a/skyflow/vault/data/_get_response.py b/skyflow/vault/data/_get_response.py index b84c7c2..466afef 100644 --- a/skyflow/vault/data/_get_response.py +++ b/skyflow/vault/data/_get_response.py @@ -4,7 +4,7 @@ def __init__(self, data=None, error = None): self.error = error def __repr__(self): - return f"GetResponse(data={self.data}, error={self.error})" + return f"GetResponse(data={self.data}, errors={self.error})" def __str__(self): return self.__repr__() \ No newline at end of file diff --git a/skyflow/vault/data/_insert_response.py b/skyflow/vault/data/_insert_response.py index fbddc0c..c9e7772 100644 --- a/skyflow/vault/data/_insert_response.py +++ b/skyflow/vault/data/_insert_response.py @@ -6,7 +6,7 @@ def __init__(self, inserted_fields = None, error_data=None): self.error_data = error_data def __repr__(self): - return f"InsertResponse(inserted_fields={self.inserted_fields}, error={self.error_data})" + return f"InsertResponse(inserted_fields={self.inserted_fields}, errors={self.error_data})" def __str__(self): return self.__repr__() diff --git a/skyflow/vault/data/_query_response.py b/skyflow/vault/data/_query_response.py index 1a98cf1..dc5100b 100644 --- a/skyflow/vault/data/_query_response.py +++ b/skyflow/vault/data/_query_response.py @@ -4,7 +4,7 @@ def __init__(self): self.error = [] def __repr__(self): - return f"QueryResponse(fields={self.fields}, error={self.error})" + return f"QueryResponse(fields={self.fields}, errors={self.error})" def __str__(self): return self.__repr__() diff --git a/skyflow/vault/data/_update_response.py b/skyflow/vault/data/_update_response.py index 6cdedf1..04dc4cf 100644 --- a/skyflow/vault/data/_update_response.py +++ b/skyflow/vault/data/_update_response.py @@ -4,7 +4,7 @@ def __init__(self, updated_field = None, error=None): self.error = error if error is not None else [] def __repr__(self): - return f"UpdateResponse(updated_field={self.updated_field}, error={self.error})" + return f"UpdateResponse(updated_field={self.updated_field}, errors={self.error})" def __str__(self): return self.__repr__() diff --git a/skyflow/vault/tokens/_tokenize_request.py b/skyflow/vault/tokens/_tokenize_request.py index 6e92c6b..8d9174a 100644 --- a/skyflow/vault/tokens/_tokenize_request.py +++ b/skyflow/vault/tokens/_tokenize_request.py @@ -1,3 +1,3 @@ class TokenizeRequest: - def __init__(self, tokenize_parameters): - self.tokenize_parameters = tokenize_parameters + def __init__(self, values): + self.tokenize_parameters = values diff --git a/tests/vault/controller/test__connection.py b/tests/vault/controller/test__connection.py index 0a3ddc9..5a845cf 100644 --- a/tests/vault/controller/test__connection.py +++ b/tests/vault/controller/test__connection.py @@ -1,5 +1,5 @@ import unittest -from unittest.mock import Mock, patch, call +from unittest.mock import Mock, patch from skyflow.error import SkyflowError from skyflow.utils import SkyflowMessages @@ -31,7 +31,7 @@ def test_invoke_success(self, mock_send): method=Method.POST, body=VALID_BODY, path_params=VALID_PATH_PARAMS, - request_headers=VALID_HEADERS, + headers=VALID_HEADERS, query_params=VALID_QUERY_PARAMS ) @@ -48,7 +48,7 @@ def test_invoke_invalid_headers(self, mock_send): method="POST", body=VALID_BODY, path_params=VALID_PATH_PARAMS, - request_headers=INVALID_HEADERS, + headers=INVALID_HEADERS, query_params=VALID_QUERY_PARAMS ) @@ -62,7 +62,7 @@ def test_invoke_invalid_body(self, mock_send): method="POST", body=INVALID_BODY, path_params=VALID_PATH_PARAMS, - request_headers=VALID_HEADERS, + headers=VALID_HEADERS, query_params=VALID_QUERY_PARAMS ) @@ -81,7 +81,7 @@ def test_invoke_request_error(self, mock_send): method=Method.POST, body=VALID_BODY, path_params=VALID_PATH_PARAMS, - request_headers=VALID_HEADERS, + headers=VALID_HEADERS, query_params=VALID_QUERY_PARAMS ) diff --git a/tests/vault/controller/test__vault.py b/tests/vault/controller/test__vault.py index c490eb9..938b8b6 100644 --- a/tests/vault/controller/test__vault.py +++ b/tests/vault/controller/test__vault.py @@ -4,7 +4,7 @@ from skyflow.generated.rest import RecordServiceBatchOperationBody, V1BatchRecord, RecordServiceInsertRecordBody, \ V1FieldRecords, RecordServiceUpdateRecordBody, RecordServiceBulkDeleteRecordBody, QueryServiceExecuteQueryBody, \ V1DetokenizeRecordRequest, V1DetokenizePayload, V1TokenizePayload, V1TokenizeRecordRequest, RedactionEnumREDACTION -from skyflow.utils.enums import TokenStrict, Redaction +from skyflow.utils.enums import TokenStrict from skyflow.vault.controller import Vault from skyflow.vault.data import InsertRequest, InsertResponse, UpdateResponse, UpdateRequest, DeleteResponse, \ DeleteRequest, GetRequest, GetResponse, QueryRequest, QueryResponse @@ -406,7 +406,7 @@ def test_tokenize_successful(self, mock_parse_response, mock_validate): # Mock request with tokenization parameters request = TokenizeRequest( - tokenize_parameters=[ + values=[ {"value": "value1", "column_group": "group1"}, {"value": "value2", "column_group": "group2"} ]