Esempio n. 1
0
def test_successful_payment2(connection):
    """This test verifies that tests changes are properly rollbacked"""
    accts = all_accounts()
    assert accts[1]['balance'] == 200
    pay(1, 2, 30, connection)
    accts = all_accounts()
    assert accts[1]['balance'] == 170
    assert accts[2]['balance'] == 230
Esempio n. 2
0
def test_successful_payment2(connection):
    """This test verifies that tests changes are properly rollbacked"""
    accts = all_accounts()
    assert accts[1]['balance'] == 200
    pay(1, 2, 30, connection)
    accts = all_accounts()
    assert accts[1]['balance'] == 170
    assert accts[2]['balance'] == 230
Esempio n. 3
0
def test_negative_amount(connection):
    with raises(IntegrityError):
        pay(1, 2, -1, connection)
Esempio n. 4
0
def test_nonexisting_account_id(connection):
    with raises(IntegrityError):
        pay(101, 2, 10, connection)
Esempio n. 5
0
def test_negative_balance(connection):
    with raises(IntegrityError):
        pay(1, 2, 200.01, connection)
Esempio n. 6
0
def test_give_back_money(connection):
    before = all_accounts()
    pay(1, 2, 30, connection)
    pay(2, 1, 30, connection)
    after = all_accounts()
    assert before == after
Esempio n. 7
0
def test_transaction_log(connection):
    pay(1, 2, 30, connection)
    pay(2, 3, 30, connection)
    assert len(account_transactions(2)) == 2
Esempio n. 8
0
def test_balance_can_go_to_zero(connection):
    pay(1, 2, 200, connection)
    assert all_accounts()[1]['balance'] == 0
Esempio n. 9
0
def test_successful_payment(connection):
    pay(source=1, recipient=2, amount=30, connection=connection)
    accts = all_accounts()
    assert accts[1]['balance'] == 170
    assert accts[2]['balance'] == 230
Esempio n. 10
0
def test_negative_amount(connection):
    with raises(IntegrityError):
        pay(1, 2, -1, connection)
Esempio n. 11
0
def test_nonexisting_account_id(connection):
    with raises(IntegrityError):
        pay(101, 2, 10, connection)
Esempio n. 12
0
def test_negative_balance(connection):
    with raises(IntegrityError):
        pay(1, 2, 200.01, connection)
Esempio n. 13
0
def test_give_back_money(connection):
    before = all_accounts()
    pay(1, 2, 30, connection)
    pay(2, 1, 30, connection)
    after = all_accounts()
    assert before == after
Esempio n. 14
0
def test_transaction_log(connection):
    pay(1, 2, 30, connection)
    pay(2, 3, 30, connection)
    assert len(account_transactions(2)) == 2
Esempio n. 15
0
def test_balance_can_go_to_zero(connection):
    pay(1, 2, 200, connection)
    assert all_accounts()[1]['balance'] == 0
Esempio n. 16
0
def test_successful_payment(connection):
    pay(source=1, recipient=2, amount=30, connection=connection)
    accts = all_accounts()
    assert accts[1]['balance'] == 170
    assert accts[2]['balance'] == 230