forked from andela-sjames/paystack-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_verification.py
More file actions
71 lines (59 loc) · 2.3 KB
/
test_verification.py
File metadata and controls
71 lines (59 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""Script defined to test the Verification class."""
import httpretty
from paystackapi.verification import Verification
from paystackapi.tests.base_test_case import BaseTestCase
class TestVerification(BaseTestCase):
"""Class to test verification actions."""
@httpretty.activate
def test_verify_bvn(self):
"""Method defined to test bvn verification."""
httpretty.register_uri(
httpretty.GET,
self.endpoint_url("/bank/resolve_bvn/01234567689"),
content_type='text/json',
body='{"status": true, "contributors": true}',
status=200,
)
response = Verification.verify_bvn(bvn='01234567689')
self.assertTrue(response['status'])
@httpretty.activate
def test_verify_account(self):
"""Method defined to test account number verification."""
httpretty.register_uri(
httpretty.GET,
self.endpoint_url("/bank/resolve?account_number=123456&bank_code=093"),
content_type='text/json',
body='{"status": true, "contributors": true}',
status=200,
)
response = Verification.verify_account(
account_number='123456', bank_code='093')
self.assertTrue(response['status'])
@httpretty.activate
def test_verify_card_bin(self):
"""Method defined to test card bin verification."""
httpretty.register_uri(
httpretty.GET,
self.endpoint_url("/decision/bin/1234565"),
content_type='text/json',
body='{"status": true, "contributors": true}',
status=200,
)
response = Verification.verify_card_bin(card_bin='1234565')
self.assertTrue(response['status'])
@httpretty.activate
def test_verify_phone(self):
"""Method defined to test phone number verification."""
httpretty.register_uri(
httpretty.POST,
self.endpoint_url("/verifications"),
content_type='text/json',
body='{"status": true, "contributors": true}',
status=201,
)
response = Verification.verify_phone(
verification_type='truecaller',
phone='09192039203',
callback_url='https://google.com'
)
self.assertTrue(response['status'])