Esempio n. 1
0
def app_entry_with_foreign_currency():
    app = TestApp()
    EUR.set_CAD_value(1.42, date(2007, 10, 1))
    PLN.set_CAD_value(0.42, date(2007, 10, 1))
    app.add_account('first', CAD)
    app.add_account('second', PLN, account_type=AccountType.Income)
    app.show_nwview()
    app.bsheet.selected = app.bsheet.assets[0]
    app.show_account()
    app.add_entry(date='1/10/2007', transfer='second', increase='42 eur')
    app.doc.date_range = MonthRange(date(2007, 10, 1))
    return app
Esempio n. 2
0
def test_ensures_rates_multiple_currencies(app):
    # Upon calling save and load, rates are asked for the 20-today range for both USD and EUR.
    db, log = set_ratedb_for_tests()
    app.save_and_load()
    expected = {
        (date(2008, 4, 20), date(2008, 4, 29), 'USD'), 
        (date(2008, 4, 20), date(2008, 4, 29), 'EUR'),
    }
    eq_(set(log), expected)
    # Now let's test that the rates are in the DB
    eq_(USD.value_in(CAD, date(2008, 4, 20)), 1.42)
    eq_(EUR.value_in(CAD, date(2008, 4, 22)), 1.44)
    eq_(EUR.value_in(USD, date(2008, 4, 24)), 1.0)
    eq_(USD.value_in(CAD, date(2008, 4, 25)), 1.47)
    eq_(USD.value_in(CAD, date(2008, 4, 27)), 1.49)