Add 'fiscal/' from commit '102ba84500dbd9655a0471288c3e278652593ca9'
git-subtree-dir: fiscal git-subtree-mainline:d95165fc8fgit-subtree-split:102ba84500
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user