Files
GTI_GERENCIADOR_FISCAL/fiscal/tests/test_company_context_discovery.py
gti d21a9d1140 Add 'fiscal/' from commit '102ba84500dbd9655a0471288c3e278652593ca9'
git-subtree-dir: fiscal
git-subtree-mainline: d95165fc8f
git-subtree-split: 102ba84500
2026-09-29 14:43:23 -03:00

29 lines
870 B
Python

from gti_discovery.company_context import collect_company_context
class Reader:
def company_context_rows(self):
return [
{"UF": "SP", "REGIME": "SIMPLES NACIONAL", "CNPJ": "12.345.678/0001-90"},
{"UF": "SP", "REGIME": "SIMPLES NACIONAL", "CNPJ": "12.345.678/0001-90"},
]
def test_company_context_is_targeted_and_redacts_cnpj():
result = collect_company_context(Reader())
assert result == {"uf": "SP", "regime": "SIMPLES NACIONAL", "cnpj": "REDACTED", "record_count": 2}
def test_company_context_rejects_generic_readers():
class Generic:
def execute(self, sql):
return []
try:
collect_company_context(Generic())
except TypeError as error:
assert "company_context_rows" in str(error)
else:
raise AssertionError("generic query access must be rejected")