def test_company_find_by_cnpj_with_extra_query(store, example_creator): branch = example_creator.create_branch(cnpj='71.225.183/0001-34') branch.name = 'teste' branch2 = example_creator.create_branch(cnpj='71.225.183/0001-34') branch2.name = 'should not be found' extra_query = Branch.name == 'teste' branches = Branch.find_by_cnpj(store, '71.225.183/0001-34', extra_query=extra_query) assert set(branches) == {branch}
def test_company_find_by_cnpj_not_found(store, example_creator): branch = example_creator.create_branch() # company.cnpj = '71.225.183/0001-34' branch = Branch.find_by_cnpj(store, '71.225.183/0001-34') assert branch.is_empty()
def test_company_find_by_cnpj(store, example_creator): branch = example_creator.create_branch(cnpj='71.225.183/0001-34') branch2 = example_creator.create_branch(cnpj='71.225.183/0001-34') branches = Branch.find_by_cnpj(store, '71.225.183/0001-34') assert set(branches) == {branch, branch2}
def test_company_find_by_cnpj_without_branch(store, example_creator): company = example_creator.create_company() company.cnpj = '71.225.183/0001-34' branch = Branch.find_by_cnpj(store, company.cnpj) assert branch.is_empty()