"""Common Logic functions tests.""" import pytest from ows_accounting import logic @pytest.mark.parametrize('account_type, user_type', [ ('vendor', 'L'), ('subaccount', 'S') ]) def test_get_user_type_from_accounting_type(account_type, user_type): """ Test all positive cases of getting user_type""" assert user_type == logic.get_user_type_from_accounting_type(account_type) @pytest.mark.parametrize('account_type, message', [ ('', "The '' account_type is not valid."), ('z', "The 'z' account_type is not valid.") ]) def test_get_user_type_from_accounting_type_not_valid(account_type, message): """ Test negative cases of getting user_type""" with pytest.raises(ValueError) as err: logic.get_user_type_from_accounting_type(account_type) assert str(err.value) == message