def test_side_effect_with_parameters(self):
    update_invoice(self.invoice, is_available=True, customer_received=True)
    transition = Transition('test', sources=[], target='cancelled', failed_state='failed', side_effects=[update_invoice])
    self.invoice.refresh_from_db()
    self.assertTrue(self.invoice.is_available)
    self.assertTrue(self.invoice.customer_received)
    state = State(self.invoice, 'status')
    transition.change_state(state, is_available=False, customer_received=False)
    self.invoice.refresh_from_db()
    self.assertFalse(self.invoice.is_available)
    self.assertFalse(self.invoice.customer_received)
    self.assertFalse(state.is_locked())
def test_side_effect_with_parameters(self):
    update_invoice(self.invoice, is_available=True, customer_received=True)
    transition = Transition('test', sources=[], target='cancelled', failed_state='failed', side_effects=[update_invoice])
    self.invoice.refresh_from_db()
    self.assertTrue(self.invoice.is_available)
    self.assertTrue(self.invoice.customer_received)
    state = State(self.invoice, 'status')
    transition.change_state(state, is_available=False, customer_received=False)
    self.invoice.refresh_from_db()
    self.assertFalse(self.invoice.is_available)
    self.assertFalse(self.invoice.customer_received)
    self.assertFalse(state.is_locked())