1
1
import unittest
2
- from unittest .mock import patch
3
2
from rave_python import Rave , RaveExceptions , Misc
4
3
from rave_python .rave_exceptions import *
5
4
from dotenv import load_dotenv
@@ -16,54 +15,67 @@ def setUp(self):
16
15
production = False ,
17
16
usingEnv = True )
18
17
19
- def test_card_charge (self ):
20
- # sample data
21
- card_details = {
22
- "cardno" : "5531886652142950" ,
23
- "cvv" : "564" ,
24
- "expirymonth" : "09" ,
25
- "expiryyear" : "22" ,
26
- "currency" : "NGN" ,
27
- "amount" : "100" ,
28
- "email" : "user@example.com" ,
29
- "phonenumber" : "08100000000" ,
30
- "firstname" : "Test" ,
31
- "lastname" : "User" ,
32
- "txRef" : "mocked_test"
33
- }
18
+ # def test_card_charge(self):
19
+ # # sample data
20
+ # card_details = {
21
+ # "cardno": "5531886652142950",
22
+ # "cvv": "564",
23
+ # "expirymonth": "09",
24
+ # "expiryyear": "22",
25
+ # "currency": "NGN",
26
+ # "amount": "100",
27
+ # "email": "user@example.com",
28
+ # "phonenumber": "08100000000",
29
+ # "firstname": "Test",
30
+ # "lastname": "User",
31
+ # "txRef": "mocked_test"
32
+ # }
34
33
35
- faulty_card_details = {
36
- "cardno" : "5399838383838381" ,
37
- "cvv" : "470" ,
38
- "expirymonth" : "10" ,
39
- "currency" : "NGN" ,
40
- "expiryyear" : "22" ,
41
- "phonenumber" : "08100000000" ,
42
- "firstname" : "Test" ,
43
- "lastname" : "User" ,
44
- }
34
+ # faulty_card_details = {
35
+ # "cardno": "5399838383838381",
36
+ # "cvv": "470",
37
+ # "expirymonth": "10",
38
+ # "currency": "NGN",
39
+ # "expiryyear": "22",
40
+ # "phonenumber": "08100000000",
41
+ # "firstname": "Test",
42
+ # "lastname": "User",
43
+ # }
45
44
46
- mocked_card_data_1 = {
47
- 'validationRequired' : True ,
48
- 'suggestedAuth' : 'PIN' ,
49
- 'flwRef' : None ,
50
- 'authUrl' : None ,
51
- 'error' : False ,
52
- 'txRef' : 'mocked_test'
53
- }
45
+ # mocked_card_data_1 = {
46
+ # 'validationRequired': True,
47
+ # 'suggestedAuth': 'PIN',
48
+ # 'flwRef': None,
49
+ # 'authUrl': None,
50
+ # 'error': False,
51
+ # 'txRef': 'mocked_test'
52
+ # }
54
53
55
- # 1. Test case 1: successful charge initiation - should return suggested auth
56
- with patch ('Rave.Card.requests.post' ) as mocked_post :
57
- mocked_post .json .return_value = mocked_card_data_1
58
- # response = self.rave.Card.charge(card_details)
59
-
60
- # self.assertEqual(response, mocked_card_data_1)
61
- self .assertIsNotNone (mocked_card_data_1 ["suggested_auth" ])
54
+ # # 1. Test case 1: successful charge initiation - should return suggested auth
55
+ # response = self.rave.Card.charge(card_details)
56
+ # self.assertEqual(response['status'], 'success')
57
+
58
+ # # 2. Test case 2: failed charge initiation - should return IncompletePaymentDetailsError
59
+ # # 3. Test case 3: successful card charge - should return 200, response.data to include []
60
+ # # 4. Test case 4: successful charge validation - should return 200, response.data to include []
61
+ # # 5. Test case 5: successful transaction verification - should return 200, response.data to include []
62
+
63
+ # def test_eNaira(self):
64
+ # enaira_request = {
65
+ # "amount": 30,
66
+ # "PBFPubKey": os.getenv("PUBLIC_KEY"),
67
+ # "currency": "NGN",
68
+ # "email": "user@example.com",
69
+ # "meta": [{"metaname": "test", "metavalue": "12383"}],
70
+ # "ip": "123.0.1.3",
71
+ # "firstname": "Flutterwave",
72
+ # "lastname": "Tester",
73
+ # "is_token": False
74
+ # }
62
75
63
- # 2. Test case 2: failed charge initiation - should return IncompletePaymentDetailsError
64
- # 3. Test case 3: successful card charge - should return 200, response.data to include []
65
- # 4. Test case 4: successful charge validation - should return 200, response.data to include []
66
- # 5. Test case 5: successful transaction verification - should return 200, response.data to include []
76
+ # #Test case 1: successful charge attempt
77
+ # response = self.rave.Enaira.charge(enaira_request)
78
+ # self.assertEqual(response['error'], False)
67
79
68
80
69
81
0 commit comments