

@patch('stripe.Transfer.retrieve', return_value=PropertyMock(status='fish'))
def test_update_transfer(self, transfer_receive_mock):
    TRANSFER_UPDATED_TEST_DATA = deepcopy(TRANSFER_CREATED_TEST_DATA)
    TRANSFER_UPDATED_TEST_DATA['type'] = 'transfer.updated'
    TRANSFER_UPDATED_TEST_DATA['data']['object']['id'] = 'salmon'
    created_event = Event.objects.create(stripe_id=TRANSFER_CREATED_TEST_DATA['id'], kind='transfer.created', livemode=True, webhook_message=TRANSFER_CREATED_TEST_DATA, validated_message=TRANSFER_CREATED_TEST_DATA, valid=True)
    created_event.process()
    updated_event = Event.objects.create(stripe_id='evt_test_update', kind='transfer.updated', livemode=True, webhook_message=TRANSFER_UPDATED_TEST_DATA, validated_message=TRANSFER_UPDATED_TEST_DATA, valid=True)
    updated_event.process()
    transfer_instance = Transfer.objects.get(stripe_id='salmon')
    transfer_receive_mock.assert_called_once_with(transfer_instance.stripe_id)
    self.assertEqual(transfer_instance.status, 'fish')
    self.assertEquals('<amount=4.55, status=fish, stripe_id=salmon>', str(transfer_instance))

dataset/ETHPy150Open pydanny/dj-stripe/tests/test_transfer.py TransferTest.test_update_transfer/original