Beispiel #1
0
def test_create_model():
    Account.create(institution='Chase', number='1234')

    # IntegrityError is raised due to the unique constraint
    with pytest.raises(IntegrityError):
        Account.create(institution='Chase', number='1234')

    assert not Account.create(
        institution='Chase', number='1234', ignore_if_exists=True)
Beispiel #2
0
def create_accounts():
    for client in User.objects.all():
        if get_or_create_clients_group() in client.groups.all():
            accounts_count = random.randint(5, 10)
            for i in range(accounts_count):
                is_heavy_account = simple_event(10)
                money_range = random.randint(3000, 10000) if is_heavy_account else \
                    random.randint(300, 3000)
                Account.create(True, client, money_range)
Beispiel #3
0
def test_create_model():
    Account.create(institution='Chase', number='1234')

    # IntegrityError is raised due to the unique constraint
    with pytest.raises(IntegrityError):
        Account.create(institution='Chase', number='1234')

    assert not Account.create(institution='Chase', number='1234',
                              ignore_if_exists=True)
Beispiel #4
0
def account_stock(request, db):
    account = Account.create(type=AccountType.investment,
                             institution='Miraeasset',
                             number='ACCOUNT1',
                             name='미래에셋대우 1')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
def create_account(type_: AccountType, institution: str, number: str, user):
    return Account.create(type=type_,
                          name='Test account',
                          institution=institution,
                          number=number,
                          user=user,
                          ignore_if_exists=True)
Beispiel #6
0
def addAccount(request, token):
    user = Token.getUser(int(token))
    if not user:
        return Response(status=status.HTTP_401_UNAUTHORIZED)

    try:
        total = int(request.POST['total'])
    except KeyError:
        return Response(status=status.HTTP_400_BAD_REQUEST)

    try:
        number = int(request.POST['number'])
    except KeyError:
        return Response(status=status.HTTP_400_BAD_REQUEST)

    try:
        name = int(request.POST['name'])
    except KeyError:
        return Response(status=status.HTTP_400_BAD_REQUEST)

    account = Account.create(total, name, user, number)
    serializer = AccountSerializer(account)
    return Response(serializer.data, status=status.HTTP_200_OK)
Beispiel #7
0
def account_sp500(request, db):
    account = Account.create(type='investment', name='S&P500 Fund')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #8
0
def account_hf(request, db):
    account = Account.create(type='virtual', name='어니스트펀드')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #9
0
def account_checking(request, db):
    account = Account.create(type='checking', name='Shinhan Checking')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #10
0
def account_stock(request, db):
    account = Account.create(type='investment', name='신한 주식')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #11
0
def account_savings(request, db):
    account = Account.create(type='savings', name='신한은행 적금')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #12
0
def create_account(type_: AccountType, institution: str, number: str, user):
    return Account.create(
        type=type_, name='Test account', institution=institution,
        number=number, user=user, ignore_if_exists=True)
Beispiel #13
0
def account_8p(request, db):
    account = Account.create(type="virtual", name="8퍼센트")
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #14
0
def account_checking(request, db):
    account = Account.create(type="checking", name="신한은행 입출금")
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #15
0
def account_savings(request, db):
    account = Account.create(type='savings', name='신한은행 적금')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account
Beispiel #16
0
def account_stock(request, db):
    account = Account.create(
        type=AccountType.investment, institution='Miraeasset',
        number='ACCOUNT1', name='미래에셋대우 1')
    request.addfinalizer(partial(teardown, db=db, record=account))
    return account