tests: Turn tested hooks into fixtures.
This is in preparation for passing configuration to hooks. That'll be a big change already, so I wanted this to be a boring diff first.
This commit is contained in:
parent
71531913d5
commit
501bd251cb
3 changed files with 58 additions and 69 deletions
|
@ -37,47 +37,47 @@ INVALID_VALUES = {
|
||||||
|
|
||||||
TEST_KEY = 'expense-allocation'
|
TEST_KEY = 'expense-allocation'
|
||||||
|
|
||||||
|
@pytest.fixture(scope='module')
|
||||||
|
def hook():
|
||||||
|
return meta_expense_allocation.MetaExpenseAllocation()
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
||||||
def test_valid_values_on_postings(src_value, set_value):
|
def test_valid_values_on_postings(hook, src_value, set_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Assets:Cash', -25),
|
('Assets:Cash', -25),
|
||||||
('Expenses:General', 25, {TEST_KEY: src_value}),
|
('Expenses:General', 25, {TEST_KEY: src_value}),
|
||||||
])
|
])
|
||||||
checker = meta_expense_allocation.MetaExpenseAllocation()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
||||||
def test_invalid_values_on_postings(src_value):
|
def test_invalid_values_on_postings(hook, src_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Assets:Cash', -25),
|
('Assets:Cash', -25),
|
||||||
('Expenses:General', 25, {TEST_KEY: src_value}),
|
('Expenses:General', 25, {TEST_KEY: src_value}),
|
||||||
])
|
])
|
||||||
checker = meta_expense_allocation.MetaExpenseAllocation()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert errors
|
assert errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: src_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: src_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
||||||
def test_valid_values_on_transactions(src_value, set_value):
|
def test_valid_values_on_transactions(hook, src_value, set_value):
|
||||||
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
||||||
('Assets:Cash', -25),
|
('Assets:Cash', -25),
|
||||||
('Expenses:General', 25),
|
('Expenses:General', 25),
|
||||||
])
|
])
|
||||||
checker = meta_expense_allocation.MetaExpenseAllocation()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
||||||
def test_invalid_values_on_transactions(src_value):
|
def test_invalid_values_on_transactions(hook, src_value):
|
||||||
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
||||||
('Assets:Cash', -25),
|
('Assets:Cash', -25),
|
||||||
('Expenses:General', 25),
|
('Expenses:General', 25),
|
||||||
])
|
])
|
||||||
checker = meta_expense_allocation.MetaExpenseAllocation()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert errors
|
assert errors
|
||||||
testutil.check_post_meta(txn, None, None)
|
testutil.check_post_meta(txn, None, None)
|
||||||
|
|
||||||
|
@ -88,14 +88,13 @@ def test_invalid_values_on_transactions(src_value):
|
||||||
'Liabilities:CreditCard',
|
'Liabilities:CreditCard',
|
||||||
'UnearnedIncome:Donations',
|
'UnearnedIncome:Donations',
|
||||||
])
|
])
|
||||||
def test_non_expense_accounts_skipped(account):
|
def test_non_expense_accounts_skipped(hook, account):
|
||||||
meta = {TEST_KEY: 'program'}
|
meta = {TEST_KEY: 'program'}
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
(account, -25),
|
(account, -25),
|
||||||
('Expenses:General', 25, meta.copy()),
|
('Expenses:General', 25, meta.copy()),
|
||||||
])
|
])
|
||||||
checker = meta_expense_allocation.MetaExpenseAllocation()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, meta)
|
testutil.check_post_meta(txn, None, meta)
|
||||||
|
|
||||||
|
@ -106,13 +105,12 @@ def test_non_expense_accounts_skipped(account):
|
||||||
('Expenses:Services:Development', 'program'),
|
('Expenses:Services:Development', 'program'),
|
||||||
('Expenses:Services:Fundraising', 'fundraising'),
|
('Expenses:Services:Fundraising', 'fundraising'),
|
||||||
])
|
])
|
||||||
def test_default_values(account, set_value):
|
def test_default_values(hook, account, set_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Liabilites:CreditCard', -25),
|
('Liabilites:CreditCard', -25),
|
||||||
(account, 25),
|
(account, 25),
|
||||||
])
|
])
|
||||||
checker = meta_expense_allocation.MetaExpenseAllocation()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
|
@ -123,13 +121,12 @@ def test_default_values(account, set_value):
|
||||||
(testutil.FY_MID_DATE, 'program'),
|
(testutil.FY_MID_DATE, 'program'),
|
||||||
(testutil.PAST_DATE, None),
|
(testutil.PAST_DATE, None),
|
||||||
])
|
])
|
||||||
def test_default_value_set_in_date_range(date, set_value):
|
def test_default_value_set_in_date_range(hook, date, set_value):
|
||||||
txn = testutil.Transaction(date=date, postings=[
|
txn = testutil.Transaction(date=date, postings=[
|
||||||
('Liabilites:CreditCard', -25),
|
('Liabilites:CreditCard', -25),
|
||||||
('Expenses:General', 25),
|
('Expenses:General', 25),
|
||||||
])
|
])
|
||||||
checker = meta_expense_allocation.MetaExpenseAllocation()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
expect_meta = None if set_value is None else {TEST_KEY: set_value}
|
expect_meta = None if set_value is None else {TEST_KEY: set_value}
|
||||||
testutil.check_post_meta(txn, None, expect_meta)
|
testutil.check_post_meta(txn, None, expect_meta)
|
||||||
|
|
|
@ -37,47 +37,47 @@ INVALID_VALUES = {
|
||||||
|
|
||||||
TEST_KEY = 'income-type'
|
TEST_KEY = 'income-type'
|
||||||
|
|
||||||
|
@pytest.fixture(scope='module')
|
||||||
|
def hook():
|
||||||
|
return meta_income_type.MetaIncomeType()
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
||||||
def test_valid_values_on_postings(src_value, set_value):
|
def test_valid_values_on_postings(hook, src_value, set_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
('Income:Other', -25, {TEST_KEY: src_value}),
|
('Income:Other', -25, {TEST_KEY: src_value}),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
||||||
def test_invalid_values_on_postings(src_value):
|
def test_invalid_values_on_postings(hook, src_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
('Income:Other', -25, {TEST_KEY: src_value}),
|
('Income:Other', -25, {TEST_KEY: src_value}),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert errors
|
assert errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: src_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: src_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
||||||
def test_valid_values_on_transactions(src_value, set_value):
|
def test_valid_values_on_transactions(hook, src_value, set_value):
|
||||||
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
('Income:Other', -25),
|
('Income:Other', -25),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
||||||
def test_invalid_values_on_transactions(src_value):
|
def test_invalid_values_on_transactions(hook, src_value):
|
||||||
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
('Income:Other', -25),
|
('Income:Other', -25),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert errors
|
assert errors
|
||||||
testutil.check_post_meta(txn, None, None)
|
testutil.check_post_meta(txn, None, None)
|
||||||
|
|
||||||
|
@ -87,14 +87,13 @@ def test_invalid_values_on_transactions(src_value):
|
||||||
'Expenses:General',
|
'Expenses:General',
|
||||||
'Liabilities:CreditCard',
|
'Liabilities:CreditCard',
|
||||||
])
|
])
|
||||||
def test_non_income_accounts_skipped(account):
|
def test_non_income_accounts_skipped(hook, account):
|
||||||
meta = {TEST_KEY: 'RBI'}
|
meta = {TEST_KEY: 'RBI'}
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
(account, 25),
|
(account, 25),
|
||||||
('Income:Other', -25, meta.copy()),
|
('Income:Other', -25, meta.copy()),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, meta)
|
testutil.check_post_meta(txn, None, meta)
|
||||||
|
|
||||||
|
@ -110,26 +109,24 @@ def test_non_income_accounts_skipped(account):
|
||||||
('UnearnedIncome:Conferences:Registrations', 'RBI'),
|
('UnearnedIncome:Conferences:Registrations', 'RBI'),
|
||||||
('UnearnedIncome:MatchPledges', 'Donations'),
|
('UnearnedIncome:MatchPledges', 'Donations'),
|
||||||
])
|
])
|
||||||
def test_default_values(account, set_value):
|
def test_default_values(hook, account, set_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
(account, -25),
|
(account, -25),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('account', [
|
@pytest.mark.parametrize('account', [
|
||||||
'Income:Other',
|
'Income:Other',
|
||||||
])
|
])
|
||||||
def test_no_default_value(account):
|
def test_no_default_value(hook, account):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
(account, -25),
|
(account, -25),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert errors
|
assert errors
|
||||||
testutil.check_post_meta(txn, None, None)
|
testutil.check_post_meta(txn, None, None)
|
||||||
|
|
||||||
|
@ -140,13 +137,12 @@ def test_no_default_value(account):
|
||||||
(testutil.FY_MID_DATE, 'Donations'),
|
(testutil.FY_MID_DATE, 'Donations'),
|
||||||
(testutil.PAST_DATE, None),
|
(testutil.PAST_DATE, None),
|
||||||
])
|
])
|
||||||
def test_default_value_set_in_date_range(date, set_value):
|
def test_default_value_set_in_date_range(hook, date, set_value):
|
||||||
txn = testutil.Transaction(date=date, postings=[
|
txn = testutil.Transaction(date=date, postings=[
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
('Income:Donations', -25),
|
('Income:Donations', -25),
|
||||||
])
|
])
|
||||||
checker = meta_income_type.MetaIncomeType()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
expect_meta = None if set_value is None else {TEST_KEY: set_value}
|
expect_meta = None if set_value is None else {TEST_KEY: set_value}
|
||||||
testutil.check_post_meta(txn, None, expect_meta)
|
testutil.check_post_meta(txn, None, expect_meta)
|
||||||
|
|
|
@ -49,47 +49,47 @@ INVALID_VALUES = {
|
||||||
|
|
||||||
TEST_KEY = 'tax-implication'
|
TEST_KEY = 'tax-implication'
|
||||||
|
|
||||||
|
@pytest.fixture(scope='module')
|
||||||
|
def hook():
|
||||||
|
return meta_tax_implication.MetaTaxImplication()
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
||||||
def test_valid_values_on_postings(src_value, set_value):
|
def test_valid_values_on_postings(hook, src_value, set_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Accrued:AccountsPayable', 25),
|
('Accrued:AccountsPayable', 25),
|
||||||
('Assets:Cash', -25, {TEST_KEY: src_value}),
|
('Assets:Cash', -25, {TEST_KEY: src_value}),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
||||||
def test_invalid_values_on_postings(src_value):
|
def test_invalid_values_on_postings(hook, src_value):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Accrued:AccountsPayable', 25),
|
('Accrued:AccountsPayable', 25),
|
||||||
('Assets:Cash', -25, {TEST_KEY: src_value}),
|
('Assets:Cash', -25, {TEST_KEY: src_value}),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert errors
|
assert errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: src_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: src_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
@pytest.mark.parametrize('src_value,set_value', VALID_VALUES.items())
|
||||||
def test_valid_values_on_transactions(src_value, set_value):
|
def test_valid_values_on_transactions(hook, src_value, set_value):
|
||||||
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
||||||
('Accrued:AccountsPayable', 25),
|
('Accrued:AccountsPayable', 25),
|
||||||
('Assets:Cash', -25),
|
('Assets:Cash', -25),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
testutil.check_post_meta(txn, None, {TEST_KEY: set_value})
|
||||||
|
|
||||||
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
@pytest.mark.parametrize('src_value', INVALID_VALUES)
|
||||||
def test_invalid_values_on_transactions(src_value):
|
def test_invalid_values_on_transactions(hook, src_value):
|
||||||
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
txn = testutil.Transaction(**{TEST_KEY: src_value}, postings=[
|
||||||
('Accrued:AccountsPayable', 25),
|
('Accrued:AccountsPayable', 25),
|
||||||
('Assets:Cash', -25),
|
('Assets:Cash', -25),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert errors
|
assert errors
|
||||||
testutil.check_post_meta(txn, None, None)
|
testutil.check_post_meta(txn, None, None)
|
||||||
|
|
||||||
|
@ -98,34 +98,31 @@ def test_invalid_values_on_transactions(src_value):
|
||||||
'Expenses:General',
|
'Expenses:General',
|
||||||
'Liabilities:CreditCard',
|
'Liabilities:CreditCard',
|
||||||
])
|
])
|
||||||
def test_non_asset_accounts_skipped(account):
|
def test_non_asset_accounts_skipped(hook, account):
|
||||||
meta = {TEST_KEY: 'USA-Corporation'}
|
meta = {TEST_KEY: 'USA-Corporation'}
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
(account, 25),
|
(account, 25),
|
||||||
('Assets:Cash', -25, meta.copy()),
|
('Assets:Cash', -25, meta.copy()),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, meta)
|
testutil.check_post_meta(txn, None, meta)
|
||||||
|
|
||||||
def test_prepaid_expenses_skipped():
|
def test_prepaid_expenses_skipped(hook, ):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Expenses:General', 25),
|
('Expenses:General', 25),
|
||||||
('Assets:PrepaidExpenses', -25),
|
('Assets:PrepaidExpenses', -25),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, None)
|
testutil.check_post_meta(txn, None, None)
|
||||||
|
|
||||||
def test_asset_credits_skipped():
|
def test_asset_credits_skipped(hook, ):
|
||||||
txn = testutil.Transaction(postings=[
|
txn = testutil.Transaction(postings=[
|
||||||
('Income:Donations', -25),
|
('Income:Donations', -25),
|
||||||
('Assets:Cash', 25),
|
('Assets:Cash', 25),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert not errors
|
assert not errors
|
||||||
testutil.check_post_meta(txn, None, None)
|
testutil.check_post_meta(txn, None, None)
|
||||||
|
|
||||||
|
@ -136,12 +133,11 @@ def test_asset_credits_skipped():
|
||||||
(testutil.FY_MID_DATE, True),
|
(testutil.FY_MID_DATE, True),
|
||||||
(testutil.PAST_DATE, False),
|
(testutil.PAST_DATE, False),
|
||||||
])
|
])
|
||||||
def test_validation_only_in_date_range(date, need_value):
|
def test_validation_only_in_date_range(hook, date, need_value):
|
||||||
txn = testutil.Transaction(date=date, postings=[
|
txn = testutil.Transaction(date=date, postings=[
|
||||||
('Liabilites:CreditCard', 25),
|
('Liabilites:CreditCard', 25),
|
||||||
('Assets:Cash', -25),
|
('Assets:Cash', -25),
|
||||||
])
|
])
|
||||||
checker = meta_tax_implication.MetaTaxImplication()
|
errors = list(hook.run(txn))
|
||||||
errors = list(checker.run(txn))
|
|
||||||
assert bool(errors) == bool(need_value)
|
assert bool(errors) == bool(need_value)
|
||||||
testutil.check_post_meta(txn, None, None)
|
testutil.check_post_meta(txn, None, None)
|
||||||
|
|
Loading…
Reference in a new issue