File tree Expand file tree Collapse file tree 3 files changed +20
-15
lines changed
Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -127,31 +127,32 @@ def proof_of_life_validation(self) -> Optional[DocumentScore]:
127127 @property
128128 def govt_id_validation (self ) -> Optional [DocumentScore ]:
129129 return self .get_document_validation (self .govt_id_document )
130-
131130
132131 def get_document_validation (
133- self ,
134- document : Optional [VerificationDocument ]
135- ) -> Optional [DocumentScore ]:
132+ self , document : Optional [VerificationDocument ]
133+ ) -> Optional [DocumentScore ]:
136134 if not document :
137- return None
135+ return None
138136 type = document .type .replace ("-" , "_" )
139137 is_expired = (
140138 self .computed ['is_document_expired' ]['data' ][type ]
141139 if self .computed
142140 else False
143141 )
144142 steps = document .steps
145- if is_expired :
146- steps .append (VerificationDocumentStep (
147- id = f'{ type } _verification' ,
148- status = 500 ,
149- error = {
150- 'verification' : f'Document { type } expired' , 'code' : 500
151- })
143+ if is_expired :
144+ steps .append (
145+ VerificationDocumentStep (
146+ id = f'{ type } _verification' ,
147+ status = 500 ,
148+ error = {
149+ 'verification' : f'Document { type } expired' ,
150+ 'code' : 500 ,
151+ },
152+ )
152153 )
153154 return DocumentScore (
154155 all ([step .status == 200 and not step .error for step in steps ]),
155156 sum ([step .status for step in steps if not step .error ]),
156157 [step .error ['code' ] for step in steps if step .error ],
157- )
158+ )
Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ def verification_without_pol(client: Client):
227227 verification .steps = []
228228 yield verification
229229
230+
230231@pytest .fixture
231232def verification_with_govt_expired (client : Client ):
232233 verification = client .verifications .retrieve ('686c77811ee936aece7016ac' )
@@ -237,7 +238,9 @@ def verification_with_govt_expired(client: Client):
237238@pytest .fixture
238239def verification_with_poa_expired (client : Client ):
239240 verification = client .verifications .retrieve ('686c77811ee936aece7016ac' )
240- verification .computed ["is_document_expired" ]["data" ]["proof_of_residency" ] = True
241+ verification .computed ["is_document_expired" ]["data" ][
242+ "proof_of_residency"
243+ ] = True
241244 yield verification
242245
243246
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ def test_retrieve_dni_verification(verification_without_pol):
8080 assert verification .documents [0 ].document_number == '111'
8181 assert not verification .documents [0 ].ocr_number
8282
83+
8384@pytest .mark .vcr
8485def test_retrive_verification_invalid_govt (verification_with_govt_expired ):
8586 verification = verification_with_govt_expired
@@ -91,4 +92,4 @@ def test_retrive_verification_invalid_govt(verification_with_govt_expired):
9192def test_retrive_verification_invalid_poa (verification_with_poa_expired ):
9293 verification = verification_with_poa_expired
9394 assert not verification .proof_of_residency_validation .is_valid
94- assert verification .proof_of_residency_validation .error_codes
95+ assert verification .proof_of_residency_validation .error_codes
You can’t perform that action at this time.
0 commit comments