-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed path params config and added Identity Verification hooks * added support for fetching checks * fixed kyc documents tests --------- Co-authored-by: Iulian Masar <iulian.masar@codegile.com>
- Loading branch information
Showing
5 changed files
with
124 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from mangopay.resources import IdentityVerification, IdentityVerificationCheck | ||
from mangopay.utils import timestamp_from_datetime | ||
from tests.test_base import BaseTestLive | ||
|
||
|
||
class IdentityVerificationTest(BaseTestLive): | ||
_identity_verification = None | ||
|
||
def test_create_identity_verification(self): | ||
self.create_new_identity_verification() | ||
self.assertIsNotNone(IdentityVerificationTest._identity_verification) | ||
self.assertIsNotNone(IdentityVerificationTest._identity_verification.return_url) | ||
self.assertIsNotNone(IdentityVerificationTest._identity_verification.hosted_url) | ||
self.assertEqual(IdentityVerificationTest._identity_verification.status, 'PENDING') | ||
|
||
def test_get_identity_verification(self): | ||
self.create_new_identity_verification() | ||
fetched = IdentityVerification.get(IdentityVerificationTest._identity_verification.id) | ||
|
||
self.assertIsNotNone(fetched) | ||
self.assertEqual(IdentityVerificationTest._identity_verification.hosted_url, fetched.hosted_url) | ||
self.assertEqual(IdentityVerificationTest._identity_verification.return_url, fetched.return_url) | ||
self.assertEqual(IdentityVerificationTest._identity_verification.status, fetched.status) | ||
|
||
def test_get_checks(self): | ||
self.create_new_identity_verification() | ||
# can be fetched in 2 ways: | ||
|
||
# checks: IdentityVerificationCheck = IdentityVerificationCheck.get( | ||
# IdentityVerificationTest._identity_verification.id) | ||
checks: IdentityVerificationCheck = IdentityVerificationTest._identity_verification.get_checks() | ||
|
||
self.assertIsNotNone(checks) | ||
self.assertEqual(checks.status, 'PENDING') | ||
self.assertTrue(timestamp_from_datetime(checks.creation_date) > 0) | ||
self.assertTrue(timestamp_from_datetime(checks.last_update) > 0) | ||
self.assertIsNotNone(checks.checks) | ||
|
||
@staticmethod | ||
def create_new_identity_verification(): | ||
if IdentityVerificationTest._identity_verification is None: | ||
john = BaseTestLive.get_john() | ||
|
||
identity_verification = IdentityVerification() | ||
identity_verification.return_url = "https://example.com" | ||
identity_verification.tag = "created by the Python SDK" | ||
|
||
IdentityVerificationTest._identity_verification = IdentityVerification( | ||
**identity_verification.create(john.id)) | ||
return IdentityVerificationTest._identity_verification |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters