Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion incognia/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')

Expand All @@ -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)
Expand Down
14 changes: 8 additions & 6 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}',
Expand All @@ -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}'
})
Expand Down Expand Up @@ -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,
Expand Down
Loading