forked from guilhermechapiewski/correios-api-py
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f27ffc
commit eb0f65a
Showing
11 changed files
with
52 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
*.pyc | ||
*.coverage | ||
.eggs | ||
dist | ||
build | ||
packtrack.egg-info | ||
|
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
language: python | ||
|
||
before_install: pip install -r requirements.txt | ||
before_install: | ||
- python setup.py install | ||
- pip install -r requirements-dev.txt | ||
|
||
script: nosetests | ||
script: nosetests |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nose |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
setup( | ||
name='packtrack', | ||
version='1.6', | ||
version='2.0', | ||
packages=['packtrack'], | ||
author='Ale Borba', | ||
author_email='[email protected]', | ||
|
@@ -13,9 +13,8 @@ | |
url='https://github.com/aleborba/packtrack', | ||
long_description='API Python para obter informacoes de encomendas. Para mais detalhes veja a documentacao no Github: https://github.com/aleborba/packtrack/blob/master/README.textile', | ||
install_requires=[ | ||
'BeautifulSoup >= 3.1.0', | ||
'requests >= 0.14.2', | ||
'beautifulsoup4 >= 4.3.2', | ||
'requests', | ||
'beautifulsoup4 >= 4.9.3', | ||
'lxml >= 2.3.5', | ||
'zeep >= 1.6.0', | ||
], | ||
|
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 |
---|---|---|
@@ -1,29 +1,25 @@ | ||
import unittest | ||
|
||
from mock import Mock | ||
from mockito import when | ||
from unittest import TestCase | ||
from unittest.mock import Mock | ||
|
||
from packtrack import Correios | ||
|
||
|
||
class CorreiosTest(unittest.TestCase): | ||
class CorreiosTest(TestCase): | ||
|
||
def test_should_use_repository_to_get_encomenda(self): | ||
encomenda_repository_mock = Mock() | ||
when(encomenda_repository_mock).get('123', auth=None) \ | ||
.thenReturn('encomenda123') | ||
|
||
encomenda_repository_mock.get.return_value = 'encomenda123' | ||
Correios._backends[None] = encomenda_repository_mock | ||
|
||
assert Correios.track('123') == 'encomenda123' | ||
encomenda_repository_mock.get.assert_called_with('123', auth=None) | ||
|
||
def test_service_should_receive_auth(self): | ||
auth = ('mi', 'mimi') | ||
encomenda_repository_mock = Mock() | ||
when(encomenda_repository_mock).get('123', auth=auth) \ | ||
.thenReturn('encomenda123') | ||
|
||
encomenda_repository_mock.get.return_value = 'encomenda123' | ||
Correios._backends['service'] = encomenda_repository_mock | ||
|
||
assert Correios.track( | ||
'123', backend='service', auth=auth) == 'encomenda123' | ||
encomenda_repository_mock.get.assert_called_with('123', auth=auth) |
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