Skip to content

Commit 0a67a22

Browse files
author
MousumiMohanty
committed
updated the comments
1 parent 84faadb commit 0a67a22

File tree

5 files changed

+40
-21
lines changed

5 files changed

+40
-21
lines changed

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,4 @@ If you use a Telesign SDK to make your request, authentication is handled behind
3535

3636
* Learn to send a request to Telesign with code with one of our [tutorials](https://developer.telesign.com/enterprise/docs/tutorials).
3737
* Browse our [Developer Portal](https://developer.telesign.com) for tutorials, how-to guides, reference content, and more.
38-
* Check out our [sample code](https://github.com/TeleSign/sample_code) on GitHub.
39-
40-
3. Testing: Install pytest
41-
42-
`pip install pytest`
43-
44-
* Unit: pytest test_omniverify.py
45-
* Integration: pytest test_integration_omniverify.py
38+
* Check out our [sample code](https://github.com/TeleSign/sample_code) on GitHub.

RELEASE

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
2.3.0
22
- Created OmniVerify class for adding retrieve verification process functionality
3-
- Updated the VerifyClient class
4-
- Added Unit and Integration tests to telesignenterpise.test folder
3+
4+
- Refactor of Verification Process Creation: The createVerificationProcess method was moved from the 
5+
VerifyClient class to the new OmniVerify class to improve API clarity by separating omnichannel
6+
verification responsibilities, so users should now use OmniVerify.createVerificationProcess for
7+
creating verification processes, supporting better SDK organization aligned with Telesign’s evolving platform.
8+
9+
- Added unit and integration tests to telesignenterpise.test folder
510

611
2.2.2
712
- Added tracking to requests

examples/telesignenterprise.test/test_integration_omniverify.py renamed to telesignenterprise.test/test_integration_omniverify.py

File renamed without changes.

examples/telesignenterprise.test/test_omniverify.py renamed to telesignenterprise.test/test_omniverify.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,20 @@ def test_get_verification_process_success(omniverify):
5151

5252
def test_get_verification_process_invalid_reference_id(omniverify):
5353
invalid_reference_id = "invalid_id"
54-
with pytest.raises(AssertionError):
55-
omniverify.getVerificationProcess(invalid_reference_id)
54+
55+
with patch.object(OmniVerify, 'get') as mock_get:
56+
mock_response = MagicMock()
57+
mock_response.ok = False
58+
mock_response.status_code = 400
59+
mock_response.json = {"status": {"code": 3400, "description": "Invalid reference_id format"}}
60+
mock_get.return_value = mock_response
61+
62+
response = omniverify.getVerificationProcess(invalid_reference_id)
63+
64+
mock_get.assert_called_once()
65+
called_url = mock_get.call_args[0][0]
66+
67+
assert called_url == f"/verification/{invalid_reference_id}"
68+
assert not response.ok
69+
assert response.status_code == 400
70+
assert response.json["status"]["code"] == 3400

telesignenterprise/omniverify.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,25 @@ class OmniVerify(RestClient):
1515
"""
1616

1717
def __init__(self, customer_id, api_key, rest_endpoint=BASE_URL_VERIFY_API, **kwargs):
18+
"""
19+
Initializes the OmniVerify client with SDK versioning for traceability.
20+
"""
21+
sdk_version_origin = telesignenterprise.__version__
22+
sdk_version_dependency = telesign.__version__
23+
1824
super(OmniVerify, self).__init__(
1925
customer_id,
2026
api_key,
2127
rest_endpoint=rest_endpoint,
28+
source=SOURCE_SDK,
29+
sdk_version_origin=sdk_version_origin,
30+
sdk_version_dependency=sdk_version_dependency,
2231
**kwargs
2332
)
24-
self.rest_endpoint = rest_endpoint
2533

26-
def createVerificationProcess(self, phone_number, params={}):
34+
def createVerificationProcess(self, phone_number, params=None):
2735
"""
28-
Use this action to create a verification process for the specified phone number.
36+
Create a verification process for the specified phone number.
2937
3038
See https://developer.telesign.com/enterprise/reference/createverificationprocess for detailed API documentation.
3139
"""
@@ -34,21 +42,19 @@ def createVerificationProcess(self, phone_number, params={}):
3442
if "verification_policy" not in params:
3543
params["verification_policy"] = [{"method": "sms"}]
3644

37-
self.set_endpoint(BASE_URL_VERIFY_API)
3845
return self.post(PATH_VERIFICATION_CREATE, json_fields=params)
3946

40-
def getVerificationProcess(self, reference_id, params={}):
47+
def getVerificationProcess(self, reference_id, params=None):
4148
"""
4249
Retrieve details about the specified verification process.
4350
4451
:param reference_id: The unique identifier of the verification process.
4552
:param params: Optional query parameters as a dictionary.
4653
:return: Response object from the GET request.
4754
"""
48-
assert isinstance(reference_id, str) and len(reference_id) == 32, "reference_id must be a 32-character string"
49-
55+
if params is None:
56+
params = {}
5057
endpoint = PATH_VERIFICATION_RETRIEVE.format(reference_id=reference_id)
51-
self.set_endpoint(self.rest_endpoint)
5258
headers = {"Content-Type": "application/json", "Accept": "application/json"}
5359

54-
return self.get(endpoint, params=params, headers=headers)
60+
return self.get(endpoint, json_fields=params, headers=headers)

0 commit comments

Comments
 (0)