From 2be01623b834cbb79367c1d942d2103a50ecf940 Mon Sep 17 00:00:00 2001 From: Camilla Maria Date: Tue, 12 Aug 2025 14:36:30 -0300 Subject: [PATCH] feat: adds custom properties to signup request --- incognia/api.py | 4 +++- tests/test_api.py | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/incognia/api.py b/incognia/api.py index 1160041..28df50c 100644 --- a/incognia/api.py +++ b/incognia/api.py @@ -39,7 +39,8 @@ def register_new_signup(self, account_id: Optional[str] = None, device_os: Optional[str] = None, app_version: Optional[str] = None, - person_id: Optional[PersonID] = None) -> dict: + person_id: Optional[PersonID] = None, + custom_properties: Optional[dict] = None) -> dict: if not request_token: raise IncogniaError('request_token is required.') @@ -57,6 +58,7 @@ def register_new_signup(self, 'device_os': device_os.lower() if device_os is not None else None, 'app_version': app_version, 'person_id': person_id, + 'custom_properties': custom_properties } data = encode(body) return self.__request.post(Endpoints.SIGNUPS, headers=headers, data=data) diff --git a/tests/test_api.py b/tests/test_api.py index 2c85fd9..56d4779 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -66,6 +66,10 @@ class TestIncogniaAPI(TestCase): REGISTER_INVALID_SIGNUP_DATA: Final[bytes] = encode({ 'request_token': f'{INVALID_REQUEST_TOKEN}' }) + CUSTOM_PROPERTIES: Final[dict] = { + 'float_field': 6.092, + 'string_field': "the next generation of identity", + } FULL_REGISTER_SIGNUP_DATA: Final[bytes] = encode({ 'request_token': f'{REQUEST_TOKEN}', 'address_line': f'{ADDRESS_LINE}', @@ -76,12 +80,9 @@ class TestIncogniaAPI(TestCase): 'account_id': f'{ACCOUNT_ID}', 'device_os': f'{DEVICE_OS.lower()}', 'app_version': f'{APP_VERSION}', - 'person_id': PERSON_ID + 'person_id': PERSON_ID, + 'custom_properties': CUSTOM_PROPERTIES }) - CUSTOM_PROPERTIES: Final[dict] = { - 'float_field': 6.092, - 'string_field': "the next generation of identity", - } REGISTER_WEB_SIGNUP_DATA: Final[bytes] = encode({ 'request_token': f'{REQUEST_TOKEN}' }) @@ -305,7 +306,8 @@ def test_register_new_signup_when_request_token_is_valid_should_return_full_vali request_token=self.REQUEST_TOKEN, device_os=self.DEVICE_OS, app_version=self.APP_VERSION, - person_id=self.PERSON_ID) + person_id=self.PERSON_ID, + custom_properties=self.CUSTOM_PROPERTIES) mock_token_manager_get.assert_called() mock_base_request_post.assert_called_with(Endpoints.SIGNUPS,