@@ -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"}]}' ]
@@ -2637,6 +2668,30 @@ def test_uploadDocumentsForUser_success(self, mock_put):
26372668
26382669 self .assertTrue (response .token , self .data .get ('token' ))
26392670
2671+ @mock .patch ('hyperwallet.utils.ApiClient._makeRequest' )
2672+ def test_uploadDocumentsForUserAndParse_success (self , mock_put ):
2673+
2674+ mock_put .return_value = self .uploadSuccessData
2675+ response = self .api .uploadDocumentsForUser ('token' , self .value )
2676+
2677+ self .assertEqual (response .token , self .uploadSuccessData .get ('token' ))
2678+ self .assertEqual (response .documents [0 ].type , self .uploadSuccessData .get ("documents" )[0 ].type )
2679+
2680+
2681+ @mock .patch ('hyperwallet.utils.ApiClient._makeRequest' )
2682+ def test_uploadDocumentsForUserAndParseRejection_success (self , mock_put ):
2683+
2684+ mock_put .return_value = self .uploadRejectionData
2685+ response = self .api .uploadDocumentsForUser ('token' , self .value )
2686+
2687+ # print(response.documents)
2688+ # print(response.documents[0].reasons[0].name.name)
2689+
2690+ self .assertEqual (response .token , self .uploadRejectionData .get ('token' ))
2691+ self .assertEqual (response .documents [0 ].reasons [0 ].name .name , self .uploadRejectionData .get ("documents" )[0 ].reasons [0 ].name .name )
2692+ self .assertEqual (response .documents [0 ].reasons [1 ].name .name , self .uploadRejectionData .get ("documents" )[0 ].reasons [1 ].name .name )
2693+ self .assertEqual (response .documents [0 ].type , self .uploadRejectionData .get ("documents" )[0 ].type )
2694+
26402695 '''
26412696
26422697 Transfer Refunds
0 commit comments