def test_get_commission(self): qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) commission = qiwi_wallet.get_commission('26476', qiwi_wallet.proxy) assert type(commission) == pyqiwi.types.Commission for commission_range in commission.ranges: assert type(commission_range) == pyqiwi.types.CommissionRange
def test_create_wallet(self): qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) qiwi_wallet = Wallet(TOKEN, PROXY) assert isinstance(qiwi_wallet, Wallet)
def test_check_history(self): qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) history = qiwi_wallet.history() assert type(history) == dict for tnx in history['transactions']: assert type(tnx) == pyqiwi.types.Transaction assert type(history['next_txn_date']) == datetime.datetime assert type(history['next_txn_id']) == int
def test_online_commission(self): qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) commission = qiwi_wallet.get_commission('26476', qiwi_wallet.proxy) assert type(commission) == pyqiwi.types.Commission saved_range = None for commission_range in commission.ranges: assert type(commission_range) == pyqiwi.types.CommissionRange if commission_range.rate != 1.0 or commission_range.rate != 1: saved_range = commission_range online_commission = qiwi_wallet.commission('26476', qiwi_wallet.number, 100) assert online_commission.qw_commission.amount == 100 * saved_range.rate
def test_check_accounts(self): qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) accounts = qiwi_wallet.offered_accounts for account in accounts: assert type(account) == pyqiwi.types.Account
def test_stat(self): qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) stat = qiwi_wallet.stat() assert type(stat) == pyqiwi.types.Statistics
def test_check_profile(self): qiwi_wallet = Wallet(TOKEN, PROXY, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) profile = qiwi_wallet.profile assert type(profile) == pyqiwi.types.Profile
from sqlalchemy.orm.exc import NoResultFound from app.models import Donate, Chat from app.models.misc import DonateAuthor from app.stuff import inject from app import queue import cfg from pytz import utc, timezone log = logging.getLogger(__name__) msk = timezone('Europe/Moscow') w = Wallet(token=cfg.QIWI_TOKEN, number=cfg.QIWI_NUMBER) _month = timedelta(days=60) _sec = timedelta(seconds=2) @inject(sesh=True) def fetch_donates(bot, job, s): last_qiwi = Donate.q.filter( Donate.source == Donate.Source.QIWI, ).order_by(Donate.date.desc()).first() # Все входящие операции за либо последний месяц, либо промежуток # от даты последней транзакции до сейчас
def test_check_balance(self): qiwi_wallet = Wallet(TOKEN, number=NUMBER) assert isinstance(qiwi_wallet, Wallet) assert type(qiwi_wallet.balance()) == float