1
1
from decimal import Decimal
2
2
from voluptuous import MultipleInvalid
3
3
4
- from minfraud .validation import validate_transaction , validate_report
4
+ from minfraud .validation import _validate_transaction , _validate_report
5
5
6
6
import unittest
7
7
@@ -17,12 +17,12 @@ def setup_transaction(self, transaction):
17
17
def check_invalid_transaction (self , transaction ):
18
18
self .setup_transaction (transaction )
19
19
with self .assertRaises (MultipleInvalid , msg = f"{ transaction } is invalid" ):
20
- validate_transaction (transaction )
20
+ _validate_transaction (transaction )
21
21
22
22
def check_transaction (self , transaction ):
23
23
self .setup_transaction (transaction )
24
24
try :
25
- validate_transaction (transaction )
25
+ _validate_transaction (transaction )
26
26
except MultipleInvalid as e :
27
27
self .fail (f"MultipleInvalid { e .msg } thrown for { transaction } " )
28
28
@@ -55,15 +55,15 @@ def check_invalid_report(self, report):
55
55
56
56
def check_invalid_report_no_setup (self , report ):
57
57
with self .assertRaises (MultipleInvalid , msg = f"{ report } is invalid" ):
58
- validate_report (report )
58
+ _validate_report (report )
59
59
60
60
def check_report (self , report ):
61
61
self .setup_report (report )
62
62
self .check_report_no_setup (report )
63
63
64
64
def check_report_no_setup (self , report ):
65
65
try :
66
- validate_report (report )
66
+ _validate_report (report )
67
67
except MultipleInvalid as e :
68
68
self .fail (f"MultipleInvalid { e .msg } thrown for { report } " )
69
69
@@ -79,7 +79,7 @@ def test_transaction_without_device(self):
79
79
"user_id" : "usr" ,
80
80
}
81
81
}
82
- validate_transaction (transaction )
82
+ _validate_transaction (transaction )
83
83
84
84
85
85
class TestAccount (unittest .TestCase , ValidationBase ):
@@ -252,8 +252,8 @@ def test_ip_address(self):
252
252
self .check_invalid_transaction ({"device" : {"ip_address" : invalid }})
253
253
254
254
def test_missing_ip (self ):
255
- validate_transaction ({"device" : {}})
256
- validate_transaction (
255
+ _validate_transaction ({"device" : {}})
256
+ _validate_transaction (
257
257
{
258
258
"device" : {
259
259
"user_agent" : "foo" ,
@@ -262,7 +262,7 @@ def test_missing_ip(self):
262
262
)
263
263
264
264
def test_missing_device (self ):
265
- validate_transaction ({})
265
+ _validate_transaction ({})
266
266
267
267
def test_user_agent (self ):
268
268
self .check_transaction_str_type ("device" , "user_agent" )
@@ -439,6 +439,8 @@ def test_tag(self):
439
439
self .check_invalid_report ({"tag" : bad })
440
440
441
441
def test_report_valid_identifier (self ):
442
+ self .check_invalid_report_no_setup ({"tag" : "chargeback" })
443
+
442
444
self .check_report_no_setup ({"tag" : "chargeback" , "ip_address" : "1.1.1.1" })
443
445
self .check_report_no_setup (
444
446
{"tag" : "chargeback" , "minfraud_id" : "58fa38d8-4b87-458b-a22b-f00eda1aa20d" }
0 commit comments