marcelobelli/PyNFSe

View on GitHub
tests/base/conftest.py

Summary

Maintainability
B
4 hrs
Test Coverage
import os.path

import pytest

from .factories import PrestadorFactory, RPSFactory, ServicoFactory, TomadorFactory

file_path = os.path.abspath(os.path.dirname(__file__))


@pytest.fixture
def prestador():
    return PrestadorFactory()


@pytest.fixture
def tomador():
    return TomadorFactory()


@pytest.fixture
def servico():
    return ServicoFactory()


@pytest.fixture
def rps():
    return RPSFactory()


@pytest.fixture
def dados_rps(rps):
    return rps.dict()


@pytest.fixture
def dados_lote_rps(dados_rps):
    return {
        "cnpj": "12345678901234",
        "identificador": "L1",
        "inscricao_municipal": "1234567890",
        "lista_rps": [dados_rps],
        "numero_lote": 1,
    }


@pytest.fixture
def xml_rps():
    xml_path = os.path.join(file_path, "fixtures/EnviarLoteRpsEnvio.xml")
    with open(xml_path, "r") as xml:
        return xml.read()


@pytest.fixture
def xml_rps_signed():
    xml_path = os.path.join(file_path, "fixtures/EnviarLoteRpsEnvio-Signed.xml")
    with open(xml_path, "r") as xml:
        return xml.read()


@pytest.fixture
def xml_canceled_nfse():
    xml_path = os.path.join(file_path, "fixtures/CancelarNfseEnvio.xml")
    with open(xml_path, "r") as xml:
        return xml.read()


@pytest.fixture
def xml_canceled_nfse_signed():
    xml_path = os.path.join(file_path, "fixtures/CancelarNfseEnvio-Signed.xml")
    with open(xml_path, "r") as xml:
        return xml.read()


@pytest.fixture
def certificate_file_path():
    return os.path.join(file_path, "fixtures/certificate.pfx")


@pytest.fixture
def certificate_password():
    return "123456"