<commit_before>from random import random
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal

from django.contrib.auth.models import User

from accountant.models import Account, Sheaf, Invoice, Transaction
from moneyed import RUB, USD, EUR, GBP


def add_test_data(cls):
    # Test user
    cls.test_user_password = '<PASSWORD>'
    cls.test_user = User.objects.create_user(
        username='john_dow',
        email='<EMAIL>',
        password=cls.test_user_password
    )

    # Test accounts
    cls.cash = Account(title='Наличные', type=Account.ACCOUNT, dashboard=True)
    Account.add_root(instance=cls.cash)

    cls.wallet = cls.cash.add_child(title='Кошелёк', type=Account.ACCOUNT)
    for currency in (RUB, EUR):
        Sheaf.objects.create(amount=int(random() * 100),
                             currency=currency,
                             account=cls.wallet)

    cls.reserve = cls.cash.add_child(title='Заначка', type=Account.ACCOUNT)

    cls.bank = Account(title='Банк', type=Account.ACCOUNT, dashboard=True)
    Account.add_root(instance=cls.bank)
    cls.card = cls.bank.add_child(title='Дебетовая карта',
                                  bank_title='Karta *1234',
                                  type=Account.ACCOUNT)

    # Opening balance
    opening_balance = Account(title='Входящий остаток',
                              type=Account.INCOME,
                              opened=date(2015, 3, 1),
                              closed=date(2015, 3, 1))
    cls.opening_balance = Account.add_root(instance=opening_balance)
    ob_invoice = Invoice.objects.create(
        timestamp=datetime.now(tz=timezone.utc),
        comment='Входящий остаток'
    )
    Transaction.objects.create(
        date=date(2015, 3, 1),
        account=cls.opening_balance,
        amount=Decimal('-134.5'),
        currency=RUB,
        invoice=ob_invoice
    )
    Transaction.objects.create(
        date=date(2015, 3, 1),
        account=cls.wallet,
        amount=Decimal('134.5'),
        currency=RUB,
        invoice=ob_invoice
    )
    Transaction.objects.create(
        date=date(2015, 3, 1),
        account=cls.opening_balance,
        amount=Decimal('-19000'),<commit_msg>credentials for one of test accounts<commit_after>from random import random
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal

from django.contrib.auth.models import User

from accountant.models import Account, Sheaf, Invoice, Transaction
from moneyed import RUB, USD, EUR, GBP


def add_test_data(cls):
    # Test user
    cls.test_user_password = '<PASSWORD>'
    cls.test_user = User.objects.create_user(
        username='john_dow',
        email='<EMAIL>',
        password=<PASSWORD>
    )

    # Test accounts
    cls.cash = Account(title='Наличные', type=Account.ACCOUNT, dashboard=True)
    Account.add_root(instance=cls.cash)

    cls.wallet = cls.cash.add_child(title='Кошелёк', type=Account.ACCOUNT)
    for currency in (RUB, EUR):
        Sheaf.objects.create(amount=int(random() * 100),
                             currency=currency,
                             account=cls.wallet)

    cls.reserve = cls.cash.add_child(title='Заначка', type=Account.ACCOUNT)

    cls.bank = Account(title='Банк', type=Account.ACCOUNT, dashboard=True)
    Account.add_root(instance=cls.bank)
    cls.card = cls.bank.add_child(
        title='Дебетовая карта',
        bank_title='Karta *1234',
        type=Account.ACCOUNT,
        credentials='Счёт: <PASSWORD>1\nБИК: 0020045354023\nКИК: 235255'
    )

    # Opening balance
    opening_balance = Account(title='Входящий остаток',
                              type=Account.INCOME,
                              opened=date(2015, 3, 1),
                              closed=date(2015, 3, 1))
    cls.opening_balance = Account.add_root(instance=opening_balance)
    ob_invoice = Invoice.objects.create(
        timestamp=datetime.now(tz=timezone.utc),
        comment='Входящий остаток'
    )
    Transaction.objects.create(
        date=date(2015, 3, 1),
        account=cls.opening_balance,
        amount=Decimal('-134.5'),
        currency=RUB,
        invoice=ob_invoice
    )
    Transaction.objects.create(
        date=date(2015, 3, 1),
        account=cls.wallet,
        amount=Decimal('134.5'),
        currency=RUB,
        invoice=ob_invoice
    )
    Transaction.objects.create(
        date=date(2015, 3, 1),
        account=cls.opening_balance,
        amount=Decimal('-19000'),
{'fraction_non_alphanumeric': 0.11266356176535818, 'fraction_numerical': 0.02661343978709248, 'mean_word_length': 2.4880123743232794, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7433051', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1394, 'n_words': 245}