def test_status_update_rejected(self): o = OrderFactory.create(state='pending') t = TransactionFactory.create(status='pending', order=o) data = dict(Status=dict(Code=dict(Code=BUCKAROO_690_REJECTED))) update_transaction(transaction=t, data=data) assert t.status == t.STATUS_REJECTED
def test_status_update_cancelled(self): o = OrderFactory.create(state='pending') t = TransactionFactory.create(status='pending', order=o) data = dict(Status=dict(Code=dict( Code=BUCKAROO_890_CANCELLED_BY_USER))) update_transaction(transaction=t, data=data) assert t.status == t.STATUS_CANCELLED
def test_status_update_success(self): o = OrderFactory.create(state='pending') t = TransactionFactory.create(status='pending', order=o) data = dict(Status=dict(Code=dict(Code=BUCKAROO_190_SUCCESS))) update_transaction(transaction=t, data=data) assert t.status == t.STATUS_SUCCESS assert t.last_push is not None
def test_update_no_code(self): o = OrderFactory.create(state='pending') t = TransactionFactory.create(order=o) data = {1: 1} assert t.last_push is None update_transaction(transaction=t, data=data) assert t.status == t.STATUS_NEW assert t.last_push is not None
def test_no_data(self): res = update_transaction(transaction=1) assert res is None
def test_no_transaction(self): res = update_transaction(data=1) assert res is None