Commit 2ce0fccc authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_payzen: Ensure transaction is not None before process

    This also changes the raise for a more appropriated Exception
parent 32aa7a53
Pipeline #10914 failed with stage
in 0 seconds
...@@ -10,6 +10,9 @@ def storeWorkflowComment(ctx, comment): ...@@ -10,6 +10,9 @@ def storeWorkflowComment(ctx, comment):
payzen_event = context payzen_event = context
transaction = payzen_event.getDestinationValue() transaction = payzen_event.getDestinationValue()
if transaction is None:
raise ValueError("Unable to find related transaction")
assert signature in (True, False) assert signature in (True, False)
if signature is False: if signature is False:
# signature is wrong, bye bye # signature is wrong, bye bye
......
...@@ -189,7 +189,7 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort): ...@@ -189,7 +189,7 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
def test_processUpdate_noTransaction(self): def test_processUpdate_noTransaction(self):
event = self.createPayzenEvent() event = self.createPayzenEvent()
self.assertRaises( self.assertRaises(
AttributeError, ValueError,
event.PayzenEvent_processUpdate, event.PayzenEvent_processUpdate,
'a', 'b') 'a', 'b')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment