@@ -64,6 +64,37 @@ def setUp(self):
6464 'currencies' : ['USD' ],
6565 'type' : 'INDIVIDUAL'
6666 }
67+
68+ self .uploadSuccessData = {
69+ 'token' : 'tkn-12345' ,
70+ "documents" : [{
71+ "category" : "IDENTIFICATION" ,
72+ "type" : "DRIVERS_LICENSE" ,
73+ "country" : "AL" ,
74+ "status" : "NEW"
75+ }]
76+ }
77+
78+ self .uploadRejectionData = {
79+ 'token' : 'tkn-12345' ,
80+ "documents" : [{
81+ "category" : "IDENTIFICATION" ,
82+ "type" : "DRIVERS_LICENSE" ,
83+ "country" : "AL" ,
84+ "status" : "INVALID" ,
85+ "reasons" : [
86+ {
87+ "name" : "DOCUMENT_CORRECTION_REQUIRED" ,
88+ "description" : "Document requires correction"
89+ },
90+ {
91+ "name" : "DOCUMENT_NOT_DECISIVE" ,
92+ "description" : "Decision cannot be made based on document. Alternative document required"
93+ }
94+ ],
95+ "createdOn" : "2020-11-24T19:05:02"
96+ }]
97+ }
6798
6899 self .value = {
69100 'data' : ['{"documents": [{"type": "DRIVERS_LICENSE", "country": "AL", "category": "IDENTIFICATION"}]}' ]
@@ -2331,6 +2362,30 @@ def test_uploadDocumentsForUser_success(self, mock_put):
23312362
23322363 self .assertTrue (response .token , self .data .get ('token' ))
23332364
2365+ @mock .patch ('hyperwallet.utils.ApiClient._makeRequest' )
2366+ def test_uploadDocumentsForUserAndParse_success (self , mock_put ):
2367+
2368+ mock_put .return_value = self .uploadSuccessData
2369+ response = self .api .uploadDocumentsForUser ('token' , self .value )
2370+
2371+ self .assertEqual (response .token , self .uploadSuccessData .get ('token' ))
2372+ self .assertEqual (response .documents [0 ].type , self .uploadSuccessData .get ("documents" )[0 ].type )
2373+
2374+
2375+ @mock .patch ('hyperwallet.utils.ApiClient._makeRequest' )
2376+ def test_uploadDocumentsForUserAndParseRejection_success (self , mock_put ):
2377+
2378+ mock_put .return_value = self .uploadRejectionData
2379+ response = self .api .uploadDocumentsForUser ('token' , self .value )
2380+
2381+ # print(response.documents)
2382+ # print(response.documents[0].reasons[0].name.name)
2383+
2384+ self .assertEqual (response .token , self .uploadRejectionData .get ('token' ))
2385+ self .assertEqual (response .documents [0 ].reasons [0 ].name .name , self .uploadRejectionData .get ("documents" )[0 ].reasons [0 ].name .name )
2386+ self .assertEqual (response .documents [0 ].reasons [1 ].name .name , self .uploadRejectionData .get ("documents" )[0 ].reasons [1 ].name .name )
2387+ self .assertEqual (response .documents [0 ].type , self .uploadRejectionData .get ("documents" )[0 ].type )
2388+
23342389 '''
23352390
23362391 Transfer Refunds
0 commit comments