-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle freight calculation errors and improve test coverage
- Loading branch information
Showing
10 changed files
with
210 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/fixtures/cassettes/test_calculate_freight_with_error.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
interactions: | ||
- request: | ||
body: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" | ||
xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Header/><ns0:Body><ns1:CalcPrecoPrazo><ns1:nCdEmpresa>08082650</ns1:nCdEmpresa><ns1:sDsSenha>n5f9t8</ns1:sDsSenha><ns1:nCdServico>40096</ns1:nCdServico><ns1:sCepOrigem>99999000</ns1:sCepOrigem><ns1:sCepDestino>99999999</ns1:sCepDestino><ns1:nVlPeso>80.0</ns1:nVlPeso><ns1:nCdFormato>2</ns1:nCdFormato><ns1:nVlComprimento>30</ns1:nVlComprimento><ns1:nVlAltura>28</ns1:nVlAltura><ns1:nVlLargura>20</ns1:nVlLargura><ns1:nVlDiametro>16</ns1:nVlDiametro><ns1:sCdMaoPropria>N</ns1:sCdMaoPropria><ns1:nVlValorDeclarado>0.0</ns1:nVlValorDeclarado><ns1:sCdAvisoRecebimento>N</ns1:sCdAvisoRecebimento></ns1:CalcPrecoPrazo></ns0:Body></SOAP-ENV:Envelope> | ||
headers: | ||
Accept: ['*/*'] | ||
Accept-Encoding: ['gzip, deflate'] | ||
Connection: [keep-alive] | ||
Content-Length: ['909'] | ||
Content-Type: [text/xml;charset=UTF-8] | ||
SOAPAction: | ||
- !!binary | | ||
Imh0dHA6Ly90ZW1wdXJpLm9yZy9DYWxjUHJlY29QcmF6byI= | ||
User-Agent: [python-requests/2.13.0] | ||
method: POST | ||
uri: http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx | ||
response: | ||
body: {string: '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CalcPrecoPrazoResponse | ||
xmlns="http://tempuri.org/"><CalcPrecoPrazoResult><Servicos><cServico><Codigo>40096</Codigo><Valor>0,00</Valor><PrazoEntrega>0</PrazoEntrega><ValorMaoPropria>0,00</ValorMaoPropria><ValorAvisoRecebimento>0,00</ValorAvisoRecebimento><ValorValorDeclarado>0,00</ValorValorDeclarado><EntregaDomiciliar | ||
/><EntregaSabado /><Erro>-4</Erro><MsgErro>Peso excedido.</MsgErro><ValorSemAdicionais>0,00</ValorSemAdicionais><obsFim | ||
/></cServico></Servicos></CalcPrecoPrazoResult></CalcPrecoPrazoResponse></soap:Body></soap:Envelope>'} | ||
headers: | ||
Cache-Control: ['private, max-age=0'] | ||
Content-Length: ['759'] | ||
Content-Type: [text/xml; charset=utf-8] | ||
Date: ['Tue, 25 Apr 2017 18:02:42 GMT'] | ||
Server: [Microsoft-IIS/7.5] | ||
X-AspNet-Version: [4.0.30319] | ||
X-Powered-By: [ASP.NET] | ||
status: {code: 200, message: OK} | ||
version: 1 |
32 changes: 32 additions & 0 deletions
32
tests/fixtures/cassettes/test_calculate_freights_with_extra_services.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
interactions: | ||
- request: | ||
body: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://tempuri.org/" | ||
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><ns1:Body><ns0:CalcPrecoPrazo><ns0:nCdEmpresa>08082650</ns0:nCdEmpresa><ns0:sDsSenha>n5f9t8</ns0:sDsSenha><ns0:nCdServico>40096</ns0:nCdServico><ns0:sCepOrigem>07192100</ns0:sCepOrigem><ns0:sCepDestino>80030001</ns0:sCepDestino><ns0:nVlPeso>0.0</ns0:nVlPeso><ns0:nCdFormato>2</ns0:nCdFormato><ns0:nVlComprimento>18</ns0:nVlComprimento><ns0:nVlAltura>23</ns0:nVlAltura><ns0:nVlLargura>19</ns0:nVlLargura><ns0:nVlDiametro>16</ns0:nVlDiametro><ns0:sCdMaoPropria>S</ns0:sCdMaoPropria><ns0:nVlValorDeclarado>9000.00</ns0:nVlValorDeclarado><ns0:sCdAvisoRecebimento>S</ns0:sCdAvisoRecebimento></ns0:CalcPrecoPrazo></ns1:Body></SOAP-ENV:Envelope> | ||
headers: | ||
Accept: ['*/*'] | ||
Accept-Encoding: ['gzip, deflate'] | ||
Connection: [keep-alive] | ||
Content-Length: ['912'] | ||
Content-Type: [text/xml;charset=UTF-8] | ||
SOAPAction: | ||
- !!binary | | ||
Imh0dHA6Ly90ZW1wdXJpLm9yZy9DYWxjUHJlY29QcmF6byI= | ||
User-Agent: [python-requests/2.13.0] | ||
method: POST | ||
uri: http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx | ||
response: | ||
body: {string: '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CalcPrecoPrazoResponse | ||
xmlns="http://tempuri.org/"><CalcPrecoPrazoResult><Servicos><cServico><Codigo>40096</Codigo><Valor>96,03</Valor><PrazoEntrega>1</PrazoEntrega><ValorMaoPropria>5,50</ValorMaoPropria><ValorAvisoRecebimento>4,30</ValorAvisoRecebimento><ValorValorDeclarado>62,48</ValorValorDeclarado><EntregaDomiciliar>S</EntregaDomiciliar><EntregaSabado>S</EntregaSabado><Erro>0</Erro><MsgErro | ||
/><ValorSemAdicionais>23,75</ValorSemAdicionais><obsFim /></cServico></Servicos></CalcPrecoPrazoResult></CalcPrecoPrazoResponse></soap:Body></soap:Envelope>'} | ||
headers: | ||
Cache-Control: ['private, max-age=0'] | ||
Content-Length: ['773'] | ||
Content-Type: [text/xml; charset=utf-8] | ||
Date: ['Tue, 25 Apr 2017 19:17:27 GMT'] | ||
Server: [Microsoft-IIS/7.5] | ||
X-AspNet-Version: [4.0.30319] | ||
X-Powered-By: [ASP.NET] | ||
status: {code: 200, message: OK} | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters