File diff c9ff4ab74617 → a41feb94b3e0
tests/test_plugin_HookRegistry.py
Show inline comments
...
 
@@ -25,28 +25,28 @@ def hook_names(hooks, key):
 

	
 
def test_default_registrations():
 
    hooks = plugin.HOOK_REGISTRY.group_by_directive()
 
    post_hook_names = hook_names(hooks, 'Posting')
 
    assert len(post_hook_names) >= 2
 
    assert 'MetaExpenseAllocation' in post_hook_names
 
    assert 'MetaTaxImplication' in post_hook_names
 
    txn_hook_names = hook_names(hooks, 'Transaction')
 
    assert len(txn_hook_names) >= 2
 
    assert 'MetaExpenseAllocation' in txn_hook_names
 
    assert 'MetaTaxImplication' in txn_hook_names
 

	
 
def test_exclude_single():
 
    hooks = plugin.HOOK_REGISTRY.group_by_directive('-expense-allocation')
 
    post_hook_names = hook_names(hooks, 'Posting')
 
    assert post_hook_names
 
    assert 'MetaExpenseAllocation' not in post_hook_names
 
    txn_hook_names = hook_names(hooks, 'Transaction')
 
    assert txn_hook_names
 
    assert 'MetaExpenseAllocation' not in txn_hook_names
 

	
 
def test_exclude_group_then_include_single():
 
    hooks = plugin.HOOK_REGISTRY.group_by_directive('-metadata expense-allocation')
 
    post_hook_names = hook_names(hooks, 'Posting')
 
    assert 'MetaExpenseAllocation' in post_hook_names
 
    assert 'MetaTaxImplication' not in post_hook_names
 
    txn_hook_names = hook_names(hooks, 'Transaction')
 
    assert 'MetaExpenseAllocation' in txn_hook_names
 
    assert 'MetaTaxImplication' not in txn_hook_names
 

	
 
def test_include_group_then_exclude_single():
 
    hooks = plugin.HOOK_REGISTRY.group_by_directive('metadata -tax-implication')
 
    post_hook_names = hook_names(hooks, 'Posting')
 
    assert 'MetaExpenseAllocation' in post_hook_names
 
    assert 'MetaTaxImplication' not in post_hook_names
 
    txn_hook_names = hook_names(hooks, 'Transaction')
 
    assert 'MetaExpenseAllocation' in txn_hook_names
 
    assert 'MetaTaxImplication' not in txn_hook_names
 

	
 
def test_unknown_group_name():
 
    with pytest.raises(ValueError):