tests: AddEntityHook test for f2c869d
.
This commit is contained in:
parent
7bdd98075f
commit
fdcc214f9f
1 changed files with 19 additions and 17 deletions
|
@ -11,26 +11,28 @@ def test_load_all():
|
||||||
all_hooks = list(hooks.load_all())
|
all_hooks = list(hooks.load_all())
|
||||||
assert add_entity.AddEntityHook in all_hooks
|
assert add_entity.AddEntityHook in all_hooks
|
||||||
|
|
||||||
@pytest.mark.parametrize('payee,expected', [
|
@pytest.mark.parametrize('in_key,payee,out_key,expected', [
|
||||||
('Alex Smith', 'Smith-Alex'),
|
('payee', 'Alex Smith', 'entity', 'Smith-Alex'),
|
||||||
('Dakota D. Doe', 'Doe-Dakota-D'),
|
('payee', 'Dakota D. Doe', 'entity', 'Doe-Dakota-D'),
|
||||||
('Björk', 'Bjork'),
|
('payee', 'Björk', 'entity', 'Bjork'),
|
||||||
('Fran Doe-Smith', 'Doe-Smith-Fran'),
|
('payee', 'Fran Doe-Smith', 'entity', 'Doe-Smith-Fran'),
|
||||||
('Alex(Nickname) Smith', 'Smith-Alex'),
|
('payee', 'Alex(Nickname) Smith', 'entity', 'Smith-Alex'),
|
||||||
('稲荷', '稲荷'),
|
('payee', '稲荷', 'entity', '稲荷'),
|
||||||
('稲(Jan)荷', '稲荷'),
|
('payee', '稲(Jan)荷', 'entity', '稲荷'),
|
||||||
('Pøweł', 'Powel'),
|
('payee', 'Pøweł', 'entity', 'Powel'),
|
||||||
('Elyse Jan Smith', 'Smith-Elyse-Jan'),
|
('payee', 'Elyse Jan Smith', 'entity', 'Smith-Elyse-Jan'),
|
||||||
('Jan van Smith', 'van-Smith-Jan'),
|
('payee', 'Jan van Smith', 'entity', 'van-Smith-Jan'),
|
||||||
('Francis da Silva', 'da-Silva-Francis'),
|
('payee', 'Francis da Silva', 'entity', 'da-Silva-Francis'),
|
||||||
('A van der B', 'van-der-B-A'),
|
('payee', 'A van der B', 'entity', 'van-der-B-A'),
|
||||||
('A de B de la C', 'de-la-C-A-de-B'),
|
('payee', 'A de B de la C', 'entity', 'de-la-C-A-de-B'),
|
||||||
|
('corporation', 'Company A', 'corp_entity', 'Company-A'),
|
||||||
|
('corporation', 'Company A 99', 'corp_entity', 'Company-A-99'),
|
||||||
])
|
])
|
||||||
def test_add_entity(payee, expected):
|
def test_add_entity(in_key, payee, out_key, expected):
|
||||||
data = {'payee': payee}
|
data = {in_key: payee}
|
||||||
hook = add_entity.AddEntityHook(argparse.Namespace())
|
hook = add_entity.AddEntityHook(argparse.Namespace())
|
||||||
hook.run(data)
|
hook.run(data)
|
||||||
assert data['entity'] == expected
|
assert data[out_key] == expected
|
||||||
|
|
||||||
|
|
||||||
class DateRangeConfig:
|
class DateRangeConfig:
|
||||||
|
|
Loading…
Reference in a new issue