Skip to content

Commit

Permalink
SK-1731: Fix inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
saileshwar-skyflow committed Nov 20, 2024
1 parent 2f3f01f commit a28be27
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion samples/vault_api/invoke_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion samples/vault_api/tokenize_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# sample data
tokenize_values = [{"<VALUE_FIELD>": "<VALUE>", "<COLUMN_GROUP_FIELD>": "<VALUE>"}]

tokenize_request = TokenizeRequest(tokenize_parameters=tokenize_values)
tokenize_request = TokenizeRequest(values=tokenize_values)

response = skyflow_client.vault("VAULT_ID").tokenize(tokenize_request)

Expand Down
4 changes: 2 additions & 2 deletions skyflow/vault/connection/_invoke_connection_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
self.request_headers = headers if headers is not None else {}
2 changes: 1 addition & 1 deletion skyflow/vault/data/_delete_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down
2 changes: 1 addition & 1 deletion skyflow/vault/data/_get_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
2 changes: 1 addition & 1 deletion skyflow/vault/data/_insert_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
2 changes: 1 addition & 1 deletion skyflow/vault/data/_query_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
2 changes: 1 addition & 1 deletion skyflow/vault/data/_update_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
4 changes: 2 additions & 2 deletions skyflow/vault/tokens/_tokenize_request.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class TokenizeRequest:
def __init__(self, tokenize_parameters):
self.tokenize_parameters = tokenize_parameters
def __init__(self, values):
self.tokenize_parameters = values
10 changes: 5 additions & 5 deletions tests/vault/controller/test__connection.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
)

Expand All @@ -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
)

Expand All @@ -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
)

Expand All @@ -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
)

Expand Down
4 changes: 2 additions & 2 deletions tests/vault/controller/test__vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"}
]
Expand Down

0 comments on commit a28be27

Please sign in to comment.