Skip to content

Commit

Permalink
feat: clean identity deprecated param
Browse files Browse the repository at this point in the history
Implementing ENG-2457
  • Loading branch information
cowan-macady committed Dec 20, 2023
1 parent 1bedf33 commit 62f83b0
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install pipenv
run: pipx install pipenv

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pipenv"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install pipenv
run: pipx install pipenv
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pipenv"
Expand Down
10 changes: 0 additions & 10 deletions indykite_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2670,18 +2670,13 @@ def main():
record_id = "96523658"
external_id = "external-dt-id22737"
kind = "DIGITAL_TWIN_KIND_PERSON"
tenant_id = os.getenv('TENANT_ID')
type = "CarOwner"
identity_property = client_ingest.identity_property("somethingElse", "456")
identity_properties = [identity_property]
ingest_property = client_ingest.ingest_property("something", "741")
properties = [ingest_property]
upsert = client_ingest.upsert_data_node_digital_twin(
external_id,
type,
[],
tenant_id,
identity_properties,
properties)
record = client_ingest.record_upsert(record_id, upsert)
ingest_record_digital_twin = client_ingest.ingest_record(record)
Expand Down Expand Up @@ -2792,19 +2787,14 @@ def main():
# replace with actual values
record_id = "114589904"
external_id = "external-dt-id9004"
tenant_id = os.getenv('TENANT_ID')
type = "Person"
tags = []
identity_property = client_ingest.identity_property("customIdPropST904", "456")
identity_properties = [identity_property]
ingest_property = client_ingest.ingest_property("customPropST1904", "741")
properties = [ingest_property]
upsert = client_ingest.upsert_data_node_digital_twin(
external_id,
type,
tags,
tenant_id,
identity_properties,
properties)
record = client_ingest.record_upsert(record_id, upsert)

Expand Down
2 changes: 1 addition & 1 deletion indykite_sdk/ingest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, token_source=None):
return logger_error(exception)

# Imported methods
from .ingest_record import ingest_record, upsert_data_node_digital_twin, identity_property, ingest_property, \
from .ingest_record import ingest_record, upsert_data_node_digital_twin, ingest_property, \
upsert_data_node_resource, upsert_data_relation, relation_match, node_match, node_property_match, \
relation_property_match, ingest_record, delete_data_node, delete_data_relation, delete_data_node_property, \
delete_data_relation_property, record_upsert, record_delete
Expand Down
25 changes: 0 additions & 25 deletions indykite_sdk/ingest/ingest_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,13 @@ def upsert_data_node_digital_twin(self,
external_id,
type,
tags=[],
tenant_id="",
identity_properties=[],
properties=[]):
"""
upsertData with digital twin
:param self:
:param external_id: id for client ref
:param type:
:param tags:
:param tenant_id: tenant id of the DT
:param identity_properties: List of IdentityProperty objects max 10
:param properties: List of Property objects max 10
:return: UpsertData object
"""
Expand All @@ -96,8 +92,6 @@ def upsert_data_node_digital_twin(self,
external_id=str(external_id),
type=str(type),
tags=tags,
tenant_id=str(tenant_id),
identity_properties=identity_properties,
properties=properties
)
)
Expand All @@ -107,25 +101,6 @@ def upsert_data_node_digital_twin(self,
return logger.logger_error(exception)


def identity_property(self, key, value):
"""
create identity property
:param self:
:param key:
:param value:
:return: IdentityProperty object
"""
sys.excepthook = logger.handle_excepthook
try:
ip = model_pb2.IdentityProperty(
key=str(key),
value=arg_to_value(value)
)
return ip
except Exception as exception:
return logger.logger_error(exception)


def ingest_property(self, key, value):
"""
create Property object
Expand Down
14 changes: 1 addition & 13 deletions tests/test_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ def test_ingest_record_digital_twin_success():
assert client is not None
record_id = "745898"
external_id = "external-dt-id345"
tenant_id = data.get_tenant()
type = "Owner"
identity_properties = []
ingest_property = client.ingest_property("customProp", "741")
assert isinstance(ingest_property, model_pb2.Property)
properties = [ingest_property]
upsert = client.upsert_data_node_digital_twin(
external_id,
type,
[],
tenant_id,
identity_properties,
properties)
assert isinstance(upsert, model_pb2.UpsertData)
record = client.record_upsert(record_id, upsert)
Expand Down Expand Up @@ -175,18 +171,10 @@ def test_delete_record_relation_property():
assert isinstance(response, IngestRecordResponse)


def test_identity_property(capsys):
client = IngestClient()
assert client is not None
identity_property = client.identity_property([],[])
captured = capsys.readouterr()
assert "ERROR" in captured.err


def test_ingest_property(capsys):
client = IngestClient()
assert client is not None
identity_property = client.ingest_property([],[])
ing_property = client.ingest_property([],[])
captured = capsys.readouterr()
assert "ERROR" in captured.err

Expand Down
2 changes: 0 additions & 2 deletions tests/test_what_authorized.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from indykite_sdk.authorization import AuthorizationClient
from indykite_sdk.indykite.authorization.v1beta1 import authorization_service_pb2 as pb2
from indykite_sdk.model.what_authorized import WhatAuthorizedResourceTypes, WhatAuthorizedResponse
from indykite_sdk.indykite.identity.v1beta2 import model_pb2 as model
from indykite_sdk.indykite.objects.v1beta1 import struct_pb2 as pb2_struct
from indykite_sdk.indykite.identity.v1beta2 import attributes_pb2 as attributes
from indykite_sdk.indykite.authorization.v1beta1 import model_pb2 as pb2_model
from helpers import data

Expand Down

0 comments on commit 62f83b0

Please sign in to comment.