-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stp transfer #394
Stp transfer #394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Por ahora mejorar el test para que probemos que no buscamos en CEP las transacciones de STP
@@ -244,6 +244,37 @@ def test_send_transaction_restricted_accounts_curp_from_cep( | |||
) | |||
|
|||
|
|||
@patch('celery.Celery.send_task') | |||
@pytest.mark.vcr | |||
def test_send_transaction_restricted_accounts_stp_to_stp( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Este test valida que se envía el status, pero es una transferencia de STP a STP. Debemos validar que no se mandó a buscar el CEP
Puedes hacer un assert
que no se llamó a la task del CEP o que no hay ningún mensaje enviado a esa task
Codecov Report
@@ Coverage Diff @@
## master #394 +/- ##
=======================================
Coverage 99.61% 99.61%
=======================================
Files 26 26
Lines 1041 1043 +2
Branches 94 93 -1
=======================================
+ Hits 1037 1039 +2
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me parece que en ocasiones no solo los de stp a stp falla, también por ejemplo asp para solucionarlo hay que hacer que se mande el status pero agregar una nueva queue para mandar los datos una vez actualizado el cep, una opción sería separar las queues y crear también en core o manejar una lógica para que se mande el status y posteriormente se valide el cep
En preferencia creo que la primera es una opción más limpia
Ya no le puse el try-excpet MaxRetriesExceededError porque en el código hacemos un if antes de hacer el retry y en el momento que excede el número de intentos, ya no se hace el retry. |
speid/tasks/transactions.py
Outdated
@@ -93,7 +95,7 @@ def send_transaction_status(self, transaction_id: str, state: str) -> None: | |||
except MaxRequestError: | |||
rfc_curp = 'max retries' | |||
except CepError: | |||
self.retry(countdown=GET_RFC_TASK_DELAY) | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puedes juntar las excepciones MaxRequestError y CepError para en los dos casos setear rfc_curp = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En MaxRequestError se define el valor de 'max retries'
para que a la hora de ejecutar el if, no vuelva a hacer el retry
if (
not rfc_curp or rfc_curp == 'ND'
) and self.request.retries < GET_RFC_TASK_MAX_RETRIES:
self.retry(countdown=GET_RFC_TASK_DELAY * self.request.retries)
Podría juntar CepError y AssertionError
o si quieres después del if, le cambio de 'max retries'
a None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah si, me confundí es juntar Assertion y Cep Error
y poner en try el de celery MaxRetriesExceededError
if not rfc_curp or rfc_curp == 'ND':
try:
self.retry(countdown=GET_RFC_TASK_DELAY * self.request.retries)
except MaxRetriesExceededError:
pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Va
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
También queda más limpio si dejas el retry de la taareaa en un try con la exxcepcion MaxRetriesExceededError y dejas terminar la tarea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solo un cambio y ya
speid/tasks/transactions.py
Outdated
@@ -93,7 +95,7 @@ def send_transaction_status(self, transaction_id: str, state: str) -> None: | |||
except MaxRequestError: | |||
rfc_curp = 'max retries' | |||
except CepError: | |||
self.retry(countdown=GET_RFC_TASK_DELAY) | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
en vez de pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yo o veo bien, @pachCode que dices?
closes #393