From 8243b19737205464e22deddee078899f33c516a9 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 27 Jan 2020 14:30:36 -0600 Subject: [PATCH 1/8] Add debug test to improve coveralls --- dhlmex/client.py | 7 +++++-- tests/test_client_login.py | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dhlmex/client.py b/dhlmex/client.py index c2d6cb1..02779fb 100644 --- a/dhlmex/client.py +++ b/dhlmex/client.py @@ -1,3 +1,4 @@ +import logging import os from typing import Any, ClassVar, Dict, Optional @@ -14,6 +15,8 @@ ) DHL_CERT = 'prepaid-dhl-com-mx.pem' +logging.basicConfig(level=logging.DEBUG) + class Client: @@ -34,7 +37,7 @@ def __init__( self.session = Session() self.session.headers['User-Agent'] = USER_AGENT if os.getenv('DEBUG'): - print(f'Client using Charles certificate') + logging.debug(f'Client using Charles certificate') self.session.verify = DHL_CERT self._login(username, password) @@ -59,7 +62,7 @@ def _login(self, username: str, password: str) -> Response: else: raise httpe except SSLError: - raise DhlmexException('Cient on debug, but Charles not running') + raise DhlmexException('Client on debug, but Charles not running') # DHL always return 200 although there is an existing session if 'Ya existe una sesión' in resp.text: raise DhlmexException( diff --git a/tests/test_client_login.py b/tests/test_client_login.py index eb80510..8c2958a 100644 --- a/tests/test_client_login.py +++ b/tests/test_client_login.py @@ -21,6 +21,19 @@ def test_successful_login(site_urls): assert 'Administrar' in soup.find('title').text +@pytest.mark.vcr +def test_debug_login(site_urls): + os.environ['DEBUG'] = 'True' + with pytest.raises(DhlmexException) as execinfo: + client = Client(DHLMEX_USERNAME, DHLMEX_PASSWORD) + assert ( + str(execinfo.value) == f'Client on debug, but Charles not running' + ) + cert = client.session.cert + assert cert is None + client._logout() + + @pytest.mark.vcr def test_client_log_out(): client = Client(DHLMEX_USERNAME, DHLMEX_PASSWORD) From e7b1d843835e878c11d6d3672f04cfc7536b3267 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 27 Jan 2020 20:03:15 -0600 Subject: [PATCH 2/8] Remove unused decorator --- tests/test_client_login.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test_client_login.py b/tests/test_client_login.py index 8c2958a..226acba 100644 --- a/tests/test_client_login.py +++ b/tests/test_client_login.py @@ -21,16 +21,14 @@ def test_successful_login(site_urls): assert 'Administrar' in soup.find('title').text -@pytest.mark.vcr -def test_debug_login(site_urls): +def test_debug_login(): os.environ['DEBUG'] = 'True' with pytest.raises(DhlmexException) as execinfo: client = Client(DHLMEX_USERNAME, DHLMEX_PASSWORD) assert ( str(execinfo.value) == f'Client on debug, but Charles not running' ) - cert = client.session.cert - assert cert is None + assert client.session.cert client._logout() From 4c1cf988bb33326fc96f7a2a26366e29839f7360 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 4 Feb 2020 15:46:02 -0600 Subject: [PATCH 3/8] Some fixes --- dhlmex/resources/base.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/dhlmex/resources/base.py b/dhlmex/resources/base.py index a03a497..ac47b27 100644 --- a/dhlmex/resources/base.py +++ b/dhlmex/resources/base.py @@ -2,6 +2,7 @@ from typing import ClassVar, Dict from bs4 import BeautifulSoup +from dhlmex.exceptions import DhlmexException from requests import Response @@ -39,15 +40,20 @@ def get_data(resp: Response, action: Dict) -> Dict: view_state = soup.find('input', id='javax.faces.ViewState').attrs[ 'value' ] - js = soup.find('a', text=action['text']).attrs['onclick'] - matches = re.findall(r"\'(.+?)\'", js) - form_ids = [match for match in matches if match.startswith('j_id')] - j_pair_id = form_ids[1].split(',')[0] - j_id = form_ids[0] + a = soup.find('a', text=action['text']) + if a is None: + print(f'DEBUG: {resp.text}') + raise DhlmexException('Debug') + else: + js = soup.find('a', text=action['text']).attrs['onclick'] + matches = re.findall(r"\'(.+?)\'", js) + form_ids = [match for match in matches if match.startswith('j_id')] + j_pair_id = form_ids[1].split(',')[0] + j_id = form_ids[0] - return { - j_id: j_id, - j_pair_id: action['code'], - 'javax.faces.ViewState': view_state, - action['end']: action['end'], - } + return { + j_id: j_id, + j_pair_id: action['code'], + 'javax.faces.ViewState': view_state, + action['end']: action['end'], + } From 70cfbc8c1ecd70d12dca4dceeb3663825c674f92 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 4 Feb 2020 15:53:32 -0600 Subject: [PATCH 4/8] Lint --- dhlmex/resources/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dhlmex/resources/base.py b/dhlmex/resources/base.py index ac47b27..15fdf13 100644 --- a/dhlmex/resources/base.py +++ b/dhlmex/resources/base.py @@ -2,9 +2,10 @@ from typing import ClassVar, Dict from bs4 import BeautifulSoup -from dhlmex.exceptions import DhlmexException from requests import Response +from dhlmex.exceptions import DhlmexException + class Resource: _client: ClassVar["dhlmex.Client"] # type: ignore From 3d483ee5bd9d9dee9919fae86152b11b18ebb1b4 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 4 Feb 2020 16:42:12 -0600 Subject: [PATCH 5/8] Add exception --- dhlmex/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dhlmex/client.py b/dhlmex/client.py index 02779fb..d2ec865 100644 --- a/dhlmex/client.py +++ b/dhlmex/client.py @@ -55,6 +55,7 @@ def _login(self, username: str, password: str) -> Response: 'javax.faces.ViewState': 'j_id1', 'j_id6:j_id29': 'j_id6:j_id29', } + print(f'DEBUG: {data}') resp = self.post(endpoint, data) except HTTPError as httpe: if 'Su sesión ha caducado' in resp.text: @@ -68,6 +69,8 @@ def _login(self, username: str, password: str) -> Response: raise DhlmexException( f'There is an exisiting session on DHL for {username}' ) + if 'Verifique su usuario' in resp.text: + raise DhlmexException('Invalid credentials') return resp def _logout(self) -> Response: From 36716a6af52a120aab5c6ff3ef156a11449e7ac4 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 4 Feb 2020 19:45:39 -0600 Subject: [PATCH 6/8] Catch invalid fill data --- dhlmex/resources/guides.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dhlmex/resources/guides.py b/dhlmex/resources/guides.py index 0953a6b..3cae045 100644 --- a/dhlmex/resources/guides.py +++ b/dhlmex/resources/guides.py @@ -16,7 +16,8 @@ class Guide(Resource): @classmethod def create_guide( - cls, origin: Origin, destination: Destination, details: OrderDetails, + cls, origin: Origin, destination: Destination, + details: OrderDetails, ) -> Tuple[str, Optional[bytes]]: guide = cls() try: @@ -95,7 +96,8 @@ def _select_guide(self, guides_data: Dict) -> Dict: return select_data def _fill_guide_table( - self, origin: Origin, destination: Destination, details: OrderDetails + self, origin: Origin, destination: Destination, + details: OrderDetails ) -> str: resp = self._client.get(self._urls['capture']) soup = BeautifulSoup(resp.text, features='html.parser') @@ -128,9 +130,19 @@ def _fill_guide_table( fill_data['javax.faces.ViewState'] = view_state fill_data['datos:j_id105'] = 'datos:j_id105' - self._client.post(self._urls['capture'], fill_data) + msg = self._validate_data() + if msg: + raise DhlmexException(f'Invalid data: {msg}') + else: + return fill_data['javax.faces.ViewState'] - return fill_data['javax.faces.ViewState'] + def _validate_data(self, fill_data: Dict) -> str: + resp = self._client.post(self._urls['capture'], fill_data) + if 'messageError' in resp.text: + soup = BeautifulSoup(resp.text, features='html.parser') + msg = soup.find('span', {'class': 'rich-messages-label'}).text + return msg + return '' def _confirm_capture(self, view_state: str) -> Response: confirm_data = { From c3116347a832d8d5e7ff7fbbdcb53f703488a86d Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 5 Feb 2020 08:38:32 -0600 Subject: [PATCH 7/8] Add missing data tests --- dhlmex/client.py | 1 - dhlmex/resources/base.py | 29 +- dhlmex/resources/guides.py | 8 +- tests/cassettes/test_invalid_creds.yaml | 318 +++ tests/conftest.py | 15 + .../cassettes/test_missing_city.yaml | 2520 +++++++++++++++++ tests/resources/test_invalid_data.py | 9 +- tests/test_client_login.py | 9 + 8 files changed, 2883 insertions(+), 26 deletions(-) create mode 100644 tests/cassettes/test_invalid_creds.yaml create mode 100644 tests/resources/cassettes/test_missing_city.yaml diff --git a/dhlmex/client.py b/dhlmex/client.py index d2ec865..67e5fbd 100644 --- a/dhlmex/client.py +++ b/dhlmex/client.py @@ -55,7 +55,6 @@ def _login(self, username: str, password: str) -> Response: 'javax.faces.ViewState': 'j_id1', 'j_id6:j_id29': 'j_id6:j_id29', } - print(f'DEBUG: {data}') resp = self.post(endpoint, data) except HTTPError as httpe: if 'Su sesión ha caducado' in resp.text: diff --git a/dhlmex/resources/base.py b/dhlmex/resources/base.py index 15fdf13..a03a497 100644 --- a/dhlmex/resources/base.py +++ b/dhlmex/resources/base.py @@ -4,8 +4,6 @@ from bs4 import BeautifulSoup from requests import Response -from dhlmex.exceptions import DhlmexException - class Resource: _client: ClassVar["dhlmex.Client"] # type: ignore @@ -41,20 +39,15 @@ def get_data(resp: Response, action: Dict) -> Dict: view_state = soup.find('input', id='javax.faces.ViewState').attrs[ 'value' ] - a = soup.find('a', text=action['text']) - if a is None: - print(f'DEBUG: {resp.text}') - raise DhlmexException('Debug') - else: - js = soup.find('a', text=action['text']).attrs['onclick'] - matches = re.findall(r"\'(.+?)\'", js) - form_ids = [match for match in matches if match.startswith('j_id')] - j_pair_id = form_ids[1].split(',')[0] - j_id = form_ids[0] + js = soup.find('a', text=action['text']).attrs['onclick'] + matches = re.findall(r"\'(.+?)\'", js) + form_ids = [match for match in matches if match.startswith('j_id')] + j_pair_id = form_ids[1].split(',')[0] + j_id = form_ids[0] - return { - j_id: j_id, - j_pair_id: action['code'], - 'javax.faces.ViewState': view_state, - action['end']: action['end'], - } + return { + j_id: j_id, + j_pair_id: action['code'], + 'javax.faces.ViewState': view_state, + action['end']: action['end'], + } diff --git a/dhlmex/resources/guides.py b/dhlmex/resources/guides.py index 3cae045..24156ed 100644 --- a/dhlmex/resources/guides.py +++ b/dhlmex/resources/guides.py @@ -16,8 +16,7 @@ class Guide(Resource): @classmethod def create_guide( - cls, origin: Origin, destination: Destination, - details: OrderDetails, + cls, origin: Origin, destination: Destination, details: OrderDetails, ) -> Tuple[str, Optional[bytes]]: guide = cls() try: @@ -96,8 +95,7 @@ def _select_guide(self, guides_data: Dict) -> Dict: return select_data def _fill_guide_table( - self, origin: Origin, destination: Destination, - details: OrderDetails + self, origin: Origin, destination: Destination, details: OrderDetails ) -> str: resp = self._client.get(self._urls['capture']) soup = BeautifulSoup(resp.text, features='html.parser') @@ -130,7 +128,7 @@ def _fill_guide_table( fill_data['javax.faces.ViewState'] = view_state fill_data['datos:j_id105'] = 'datos:j_id105' - msg = self._validate_data() + msg = self._validate_data(fill_data) if msg: raise DhlmexException(f'Invalid data: {msg}') else: diff --git a/tests/cassettes/test_invalid_creds.yaml b/tests/cassettes/test_invalid_creds.yaml new file mode 100644 index 0000000..584a117 --- /dev/null +++ b/tests/cassettes/test_invalid_creds.yaml @@ -0,0 +1,318 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: GET + uri: https://prepaid.dhl.com.mx/Prepago/ + response: + body: + string: "\n\n\n \n \n Login\ + \ / Admin\n \n \n \n \n \n \n \n \n \n\ + \
\n \n
\n\n \n
\n
\n \ + \ \n
\n
\n \"DHL\n
\n
\n\ + \ \n\n \n\n \n
\n
\n
\n\n\n \ + \
\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\ +
Prepago\ + \ DHL
Debe autenticarse en el sistema para acceder
\n\n\n\n\n\n\ + \n\ + \n\n\n\n\n\ + \n\n\n
\n\n\n\n\n\ + \n\n\n\n\n\n
Usuario:
Contraseña:
\n
Recuperar Contraseña
\n\n\n\n\n\n\ + \n
\n
\n
\n
\n\n
\n
Recuperar Contraseña
\n
\n\n\n\n\n\n\n\n\n\n\n\n
Recuperación\ + \ de Contraseña
Usuario:
\n\"\
\"\"\n\n\n\n\n\n\n\ +
\n\n
new ModalPanel('pnlUsuario',\n\t\t\t\t{\n\t\t\t\ + \t\twidth: 400,\n\t\t\t\t\theight: 200,\n\n\t\t\t\t\tminWidth: -1,\n\t\t\t\ + \t\tminHeight: -1,\n\n\t\t\t\t\tresizeable: true,\n\t\t\t\t\tmoveable: true,\n\ + \n\t\t\t\t\tleft: \"auto\",\n\t\t\t\t\ttop: \"auto\",\n\n\t\t\t\t\tzindex:\ + \ 100,onresize: '',onmove: '',onshow: '',onhide: '',onbeforeshow: '',onbeforehide:\ + \ '',\n\t\t\t\t\tdomElementAttachment: \"\",\t\t\t\t\n\t\t\t\t\tkeepVisualState:\ + \ false,\n\t\t\t\t\tshowWhenRendered: false,\n\t\t\t\t\tselectBehavior: \"\ + disable\",\n\n\t\t\t\t\tautosized: false,\n\t\t\t\t\toverlapEmbedObjects:\ + \ false});
\n\ + \ \n \n \n\n \n \ + \ \n \n \n\n \n
\n \n \"Deutsche\n \n
\n\n \ + \ \n \n" + headers: + Content-Type: + - text/html;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:15:46 GMT + Server: + - Apache-Coyote/1.1 + Set-Cookie: + - JSESSIONID=E190FC94FE243B7B23387AD81E554633; Path=/Prepago/; HttpOnly + - BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000; path=/; Httponly; Secure + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=%5B%27_viewRoot%27%5D&j_id6=%5B%27j_id6%27%5D&j_id6%3Aj_id20=%5B%27USERNAME%27%5D&j_id6%3Aj_id22=%5B%27PASSWORD%27%5D&javax.faces.ViewState=%5B%27j_id1%27%5D&j_id6%3Aj_id29=%5B%27j_id6%3Aj_id29%27%5D + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '153' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=E190FC94FE243B7B23387AD81E554633; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/login/login.xhtml + response: + body: + string: "\r\n\r\n
Verifique\ + \ su usuario/contrase\xF1a
Usuario:Contrase\xF1a:
Recuperar Contrase\xF1a
Verifique su usuario/contrase\xF1a
" + headers: + Ajax-Response: + - 'true' + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Length: + - '4503' + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:15:46 GMT + Expires: + - '0' + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +version: 1 diff --git a/tests/conftest.py b/tests/conftest.py index 4674a08..50e2a0d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -85,6 +85,21 @@ def invalid_destination() -> Destination: ) +@pytest.fixture +def missing_data() -> Destination: + return Destination( + company='GREGORIO CASTRO', + contact='GREGORIO CASTRO', + email='greg@gmail.com', + phone='550909090', + address1='REFORMA 222', + postal_code='06600', + neighborhood='JUAREZ', + city='', + state='CDMX', + ) + + @pytest.fixture def invalid_postal_code() -> Destination: return Destination( diff --git a/tests/resources/cassettes/test_missing_city.yaml b/tests/resources/cassettes/test_missing_city.yaml new file mode 100644 index 0000000..a26342e --- /dev/null +++ b/tests/resources/cassettes/test_missing_city.yaml @@ -0,0 +1,2520 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: GET + uri: https://prepaid.dhl.com.mx/Prepago/ + response: + body: + string: "\n\n\n \n \n Login\ + \ / Admin\n \n \n \n \n \n \n \n \n \n\ + \
\n \n
\n\n \n
\n
\n \ + \ \n
\n
\n \"DHL\n
\n
\n\ + \ \n\n \n\n \n
\n
\n
\n\n\n \ + \
\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\ +
Prepago\ + \ DHL
Debe autenticarse en el sistema para acceder
\n\n\n\n\n\n\ + \n\ + \n\n\n\n\n\ + \n\n\n
\n\n\n\n\n\ + \n\n\n\n\n\n
Usuario:
Contraseña:
\n
Recuperar Contraseña
\n\n\n\n\n\n\ + \n
\n
\n
\n
\n\n
\n
Recuperar Contraseña
\n
\n\n\n\n\n\n\n\n\n\n\n\n
Recuperación\ + \ de Contraseña
Usuario:
\n\"\
\"\"\n\n\n\n\n\n\n\ +
\n\n
new ModalPanel('pnlUsuario',\n\t\t\t\t{\n\t\t\t\ + \t\twidth: 400,\n\t\t\t\t\theight: 200,\n\n\t\t\t\t\tminWidth: -1,\n\t\t\t\ + \t\tminHeight: -1,\n\n\t\t\t\t\tresizeable: true,\n\t\t\t\t\tmoveable: true,\n\ + \n\t\t\t\t\tleft: \"auto\",\n\t\t\t\t\ttop: \"auto\",\n\n\t\t\t\t\tzindex:\ + \ 100,onresize: '',onmove: '',onshow: '',onhide: '',onbeforeshow: '',onbeforehide:\ + \ '',\n\t\t\t\t\tdomElementAttachment: \"\",\t\t\t\t\n\t\t\t\t\tkeepVisualState:\ + \ false,\n\t\t\t\t\tshowWhenRendered: false,\n\t\t\t\t\tselectBehavior: \"\ + disable\",\n\n\t\t\t\t\tautosized: false,\n\t\t\t\t\toverlapEmbedObjects:\ + \ false});
\n\ + \ \n \n \n\n \n \ + \ \n \n \n\n \n
\n \n \"Deutsche\n \n
\n\n \ + \ \n \n" + headers: + Content-Type: + - text/html;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:20 GMT + Server: + - Apache-Coyote/1.1 + Set-Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; Path=/Prepago/; HttpOnly + - BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000; path=/; Httponly; Secure + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=%5B%27_viewRoot%27%5D&j_id6=%5B%27j_id6%27%5D&j_id6%3Aj_id20=%5B%27USERNAME%27%5D&j_id6%3Aj_id22=%5B%27PASSWORD%27%5D&javax.faces.ViewState=%5B%27j_id1%27%5D&j_id6%3Aj_id29=%5B%27j_id6%3Aj_id29%27%5D + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '148' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/login/login.xhtml + response: + body: + string: ' + + ' + headers: + Ajax-Response: + - redirect + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:20 GMT + Expires: + - '0' + Location: + - /Prepago/jsp/app/inicio/inicio.xhtml + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/inicio/inicio.xhtml + response: + body: + string: "\n\n\n \n \n Administrar\n\ + \ \n \n \n \n \n \n \n \n \n\ + \
\n \n
\n\n \n
\n
\n \ + \ \n
\n
\n \"DHL\n
\n
\n\ + \ \n\n \n\n \n
\n
\n
\n \n
\n
\n\ + \
\n \n\n
\n
\n\ +
\n\n
Cliente
Cliente
\n\n\n\n\n\n\ + \n\n\n\n\n\ + \n\n\ + \n\n\n\n\n\n\ +
\n\nImpresión Sub Usuario
Guías Impresas
Asignar Recolección (SubUsuario)
Manual de Usuario
\n
Reportes
Reportes
\n\n\n\n\n\ + \n\n
Guías Generadas (SubUsuario)
\n
Salir
Salir
\n\n\n\n\n\n\n\n\n\n\n\ +
Cambiar Password
Cerrar Sesión
\n
\n
\n
\n\ + \
\n
\n \n\n \n
\n \n \"Deutsche\n \n
\n\n \ + \ \n \n" + headers: + Content-Type: + - text/html;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:20 GMT + Server: + - Apache-Coyote/1.1 + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: j_id9=j_id9&j_id9%3Aj_id16=j_id9%3Aj_id16&javax.faces.ViewState=j_id2&j_id9%3Aj_id10=j_id9%3Aj_id14 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '99' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/inicio/inicio.xhtml + response: + body: + string: '' + headers: + Content-Length: + - '0' + Date: + - Wed, 05 Feb 2020 14:22:20 GMT + Location: + - http://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/impresionClienteSubUsuario.xhtml + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 302 + message: Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: GET + uri: http://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/impresionClienteSubUsuario.xhtml + response: + body: + string: '' + headers: + Connection: + - Keep-Alive + Content-Length: + - '0' + Location: + - https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/impresionClienteSubUsuario.xhtml + Server: + - BigIP + status: + code: 302 + message: Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: GET + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/impresionClienteSubUsuario.xhtml + response: + body: + string: "\n\n\n \n \n Impresión\n\ + \ \n \n \n \n \n \n \n \n \n\ + \
\n \n
\n\n \n
\n
\n \ + \ \n
\n
\n \"DHL\n
\n
\n\ + \ \n\n \n\n \n
\n
\n
\n\n\n
\n\n\n\n\n\n
\n\n\ + \n\n\n\ + \n\n\n\n\n\n\n\n\n\n
\n\n\ + \n\n\n\n
Impresión Sub Usuario - Ordenes\ + \ de Compra
\n
\n\n\ + \n\n\ + \n\n
\n\n\n\n\n\ + \n\n\ + \n\n\n\n\n
619434seleccionar
Ordenes de Compra
FolioFecha de CaducidadTotal de GuíasGuías UsadasGuías DisponiblesSeleccionar
1002913430/12/20203053050
1002913830/12/20204344340
1002967224/01/20211,053
\"\"
\n
\n
\"\
\n\n\n\n\ + \n\n\n\n\n
\"\"
\n\ +
\n
\n\n \ + \
\n
\n \ + \
\n
\n \n\n
\n
\n\ +
\n\n
Cliente
Cliente
\n\n\n\n\n\n\ + \n\n\n\n\n\ + \n\n\ + \n\n\n\n\n\n\ +
\n\nImpresión Sub Usuario
Guías Impresas
Asignar Recolección (SubUsuario)
Manual de Usuario
\n
Reportes
Reportes
\n\n\n\n\n\ + \n\n
Guías Generadas (SubUsuario)
\n
Salir
Salir
\n\n\n\n\n\n\n\n\n\n\n\ +
Cambiar Password
Cerrar Sesión
\n
\n
\n
\n\ + \
\n
\n \n\n \n
\n \n \"Deutsche\n \n
\n\n \ + \ \n \n" + headers: + Content-Type: + - text/html;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:22 GMT + Server: + - Apache-Coyote/1.1 + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=_viewRoot&j_id6=j_id6&javax.faces.ViewState=j_id3&j_id6%3AtblElementos%3A2%3AlinkEditar=j_id6%3AtblElementos%3A2%3AlinkEditar + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '137' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/impresionClienteSubUsuario.xhtml + response: + body: + string: "\r\n\r\n
Capturar Gu\xEDas a Imprimir
Productos Disponibles
Descripci\xF3nGu\xEDas TotalesGu\xEDas ImpresasGu\xEDas DisponiblesGu\xEDas a Imprimir
Totales10536194340
Documento\ + \ 1 KG1,053619434
" + headers: + Ajax-Response: + - 'true' + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Length: + - '6686' + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:22 GMT + Expires: + - '0' + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=_viewRoot&j_id6=j_id6&j_id6%3Aj_id48%3A0%3Aj_id71=1&javax.faces.ViewState=j_id3&j_id6%3Aj_id48%3A0%3Aj_id72=j_id6%3Aj_id48%3A0%3Aj_id72&AJAX%3AEVENTS_COUNT=1 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '169' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/impresionClienteSubUsuario.xhtml + response: + body: + string: "\r\n\r\n1
" + headers: + Ajax-Response: + - 'true' + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Length: + - '4128' + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:22 GMT + Expires: + - '0' + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=_viewRoot&j_id6=j_id6&j_id6%3Aj_id48%3A0%3Aj_id71=1&javax.faces.ViewState=j_id3&j_id6%3AbtnGuardarCotizacion=j_id6%3AbtnGuardarCotizacion + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '149' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/impresionClienteSubUsuario.xhtml + response: + body: + string: ' + + ' + headers: + Ajax-Response: + - redirect + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:22 GMT + Expires: + - '0' + Location: + - /Prepago/jsp/app/cliente/capturaDatosImpresionClienteSU.xhtml + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: GET + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/capturaDatosImpresionClienteSU.xhtml + response: + body: + string: "\n\n\n \n \n Datos\ + \ de Impresión\n \n \n \n \n \n \n \n \n \n\ + \
\n \n
\n\n \n
\n
\n \ + \ \n
\n
\n \"DHL\n
\n
\n\ + \ \n\n \n\n \n
\n
\n
\n\n\n
\n\n\ + \n
\n\n\n\ + \n\n\n
Impresión Sub Usuario- Capturar información
\n\n\n\n\n\n\n\n\n
\"\"
\"\"
\"\"\"\"
Remitente
\"\"
\"\"\
\"\"
Destinatario
\"\"
\"\"\
\"\"
Detalles
\"\"
\"\"\
\n\n\n\ + \n\ + \n\n\n\n\n\n\n\ + \n\n\n\n\n\n\n\n\n\n\ + \n\n\n\n\ + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ + \n\ + \n\n\n
* Compañia:
* Contacto:
Correo:
* Teléfono:
* Dirección 1:
Línea 2:
Referencia:
* Código Postal:
* Colonia
* Ciudad:
* Estado:
\n\ +
\n\n\n\ + \n\ + \n\n\n\n\n\n\n\ + \n\n\n\n\ + \n\ + \n\n\n\n\n\ + \n\n\n\n\ + \n\n\n\n\ + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\ + \n\ + \n\n\n
* Compañia:
* Contacto:
Correo:
* Teléfono:
* Dirección 1:
Linea 2:
Referencia:
* Código\ + \ Postal:
* Colonia
* Ciudad:
* Estado:
\n\ +
\n\n\n\ + \n\ + \n\n\n\n\n\n\n\ +
*Descripción:
Contenido de\ + \ la Pieza:
\n
\n\n\n\ + La información marcada con (*) debe ser capturada.\n\n\n\n\ + \n\n\n\n\n\n
\n\ + \n\n\n\n\n\n\n\n\n\ + \n
\n\n\n\n\n\n\n\n\ + \n\n
\n \n
Confirmación\ + \ antes de imprimir
\n
\n\n\n\n\n\n\ + \n\n\n\n\n
Todas las guías seleccionadas para imprimir\ + \ aparecerán con los datos ingresados en esa sección.
\n\n\ + \n\n\n\n\n\ +
\n
\n\n\ +
Generando Guías...
\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\ + \n\n
\n
\n \ + \
\n\n\n\n\n\n\ +
\n
\n\n \n function limitArea(valor,maximo){\n\ + \ if(valor.length > maximo){\n \ + \ valor = valor.substring(0,maximo);\n \ + \ }\n return valor;\n \ + \ }\n \n \n
Confirmación Cerrar
\n
\n\n\n\n\n\n\n\n\n\n\n\n\ + \n\n\n\n\n
Estimado Usuario:
\n \ + \
Podrá encontrar la(s)\ + \ guía(s) generada(s) en esta sección. Le recordamos que sólo\ + \ estarán disponibles 24 horas, le invitamos a guardar sus archivos.
\n\n\ + \n\n\n\n\ +
\n
\n\n\ +
\n \n \ + \ \n \n\n
\n
\n\ +
\n\n
Cliente
Cliente
\n\n\n\n\n\n\ + \n\n\n\n\n\ + \n\n\ + \n\n\n\n\n\n\ +
\n\nImpresión Sub Usuario
Guías Impresas
Asignar Recolección (SubUsuario)
Manual de Usuario
\n
Reportes
Reportes
\n\n\n\n\n\ + \n\n
Guías Generadas (SubUsuario)
\n
Salir
Salir
\n\n\n\n\n\n\n\n\n\n\n\ +
Cambiar Password
Cerrar Sesión
\n
\n
\n
\n\ + \
\n \n \n\n \n
\n \n \"Deutsche\n \n
\n\n \ + \ \n \n" + headers: + Content-Type: + - text/html;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:23 GMT + Server: + - Apache-Coyote/1.1 + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=_viewRoot&datos=datos&datos%3Aj_id10=j_id11&datos%3Aj_id15=&datos%3Aj_id19=&datos%3AemailOrigen=&datos%3Aj_id24=&datos%3Aj_id28=&datos%3Aj_id30=&datos%3Aj_id32=&datos%3Aj_id36=06600&datos%3Aj_id41=&datos%3Aj_id45=&datos%3Aj_id49=&datos%3Aj_id54=&datos%3Aj_id58=&datos%3AemailDestino=&datos%3Aj_id63=&datos%3Aj_id67=&datos%3Aj_id69=&datos%3Aj_id71=&datos%3Aj_id75=&datos%3Aj_id80=&datos%3Aj_id84=&datos%3Aj_id88=&datos%3Aj_id93=&datos%3Aj_id95=&javax.faces.ViewState=j_id4&datos%3Aj_id37=datos%3Aj_id37 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '513' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/capturaDatosImpresionClienteSU.xhtml + response: + body: + string: "\r\n\r\nCorreo:* Tel\xE9fono:L\xEDnea 2:Referencia:* C\xF3digo Postal:* Estado:
* Compa\xF1\ + ia:
* Contacto:
* Direcci\xF3n 1:
* Colonia
* Ciudad:
C\xF3digo Postal\ + \ v\xE1lido
" + headers: + Ajax-Response: + - 'true' + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Length: + - '6077' + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:24 GMT + Expires: + - '0' + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=_viewRoot&datos=datos&datos%3Aj_id10=j_id11&datos%3Aj_id15=&datos%3Aj_id19=&datos%3AemailOrigen=&datos%3Aj_id24=&datos%3Aj_id28=&datos%3Aj_id30=&datos%3Aj_id32=&datos%3Aj_id36=06600&datos%3Aj_id41=&datos%3Aj_id45=&datos%3Aj_id49=&datos%3Aj_id54=&datos%3Aj_id58=&datos%3AemailDestino=&datos%3Aj_id63=&datos%3Aj_id67=&datos%3Aj_id69=&datos%3Aj_id71=&datos%3Aj_id75=06600&datos%3Aj_id80=&datos%3Aj_id84=&datos%3Aj_id88=&datos%3Aj_id93=&datos%3Aj_id95=&javax.faces.ViewState=j_id4&datos%3Aj_id76=datos%3Aj_id76 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '518' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/capturaDatosImpresionClienteSU.xhtml + response: + body: + string: "\r\n\r\nCorreo:* Tel\xE9fono:Linea 2:Referencia:* C\xF3digo Postal:* Estado:
* Compa\xF1\ + ia:
* Contacto:
* Direcci\xF3n 1:
* Colonia
* Ciudad:
C\xF3digo Postal\ + \ v\xE1lido
" + headers: + Ajax-Response: + - 'true' + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Length: + - '6167' + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:24 GMT + Expires: + - '0' + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: AJAXREQUEST=_viewRoot&datos=datos&datos%3Aj_id10=j_id11&datos%3Aj_id15=CUENCA+LABS&datos%3Aj_id19=GINO+LAPI&datos%3AemailOrigen=gino%40cuenca.com&datos%3Aj_id24=5544364200&datos%3Aj_id28=VARSOVIA+36&datos%3Aj_id30=&datos%3Aj_id32=&datos%3Aj_id36=06600&datos%3Aj_id41=JUAREZ&datos%3Aj_id45=CUAUHTEMOC&datos%3Aj_id49=CMX&datos%3Aj_id54=GREGORIO+CASTRO&datos%3Aj_id58=GREGORIO+CASTRO&datos%3AemailDestino=greg%40gmail.com&datos%3Aj_id63=550909090&datos%3Aj_id67=REFORMA+222&datos%3Aj_id69=&datos%3Aj_id71=CASA+COLOR+VERDE&datos%3Aj_id75=06600&datos%3Aj_id80=JUAREZ&datos%3Aj_id84=&datos%3Aj_id88=CDMX&datos%3Aj_id93=Tarjetas+de+presentacion&datos%3Aj_id95=&javax.faces.ViewState=j_id4&datos%3Aj_id105=datos%3Aj_id105 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '713' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/cliente/capturaDatosImpresionClienteSU.xhtml + response: + body: + string: "\r\n\r\n
Ciudad Destinatario es requerido
if(data){validaEmails();}if(data){validaEmails();}" + headers: + Ajax-Response: + - 'true' + Cache-Control: + - no-cache, must-revalidate, max_age=0, no-store + Content-Length: + - '4195' + Content-Type: + - text/xml;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:26 GMT + Expires: + - '0' + Pragma: + - no-cache + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/inicio/inicio.xhtml + response: + body: + string: "\n\n\n \n \n Administrar\n\ + \ \n \n \n \n \n \n \n \n \n\ + \
\n \n
\n\n \n
\n
\n \ + \ \n
\n
\n \"DHL\n
\n
\n\ + \ \n\n \n\n \n
\n
\n
\n \n
\n
\n\ + \
\n \n\n
\n
\n\ +
\n\n
Cliente
Cliente
\n\n\n\n\n\n\ + \n\n\n\n\n\ + \n\n\ + \n\n\n\n\n\n\ +
\n\nImpresión Sub Usuario
Guías Impresas
Asignar Recolección (SubUsuario)
Manual de Usuario
\n
Reportes
Reportes
\n\n\n\n\n\ + \n\n
Guías Generadas (SubUsuario)
\n
Salir
Salir
\n\n\n\n\n\n\n\n\n\n\n\ +
Cambiar Password
Cerrar Sesión
\n
\n
\n
\n\ + \
\n
\n \n\n \n
\n \n \"Deutsche\n \n
\n\n \ + \ \n \n" + headers: + Content-Type: + - text/html;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:26 GMT + Server: + - Apache-Coyote/1.1 + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +- request: + body: j_id9=j_id9&j_id9%3Aj_id30=j_id9%3Aj_id30&javax.faces.ViewState=j_id5 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '69' + Content-Type: + - application/x-www-form-urlencoded + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/inicio/inicio.xhtml + response: + body: + string: '' + headers: + Content-Length: + - '0' + Date: + - Wed, 05 Feb 2020 14:22:26 GMT + Location: + - http://prepaid.dhl.com.mx/Prepago/jsp/app/login/login.xhtml + Server: + - Apache-Coyote/1.1 + X-Powered-By: + - JSF/1.2 + status: + code: 302 + message: Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: GET + uri: http://prepaid.dhl.com.mx/Prepago/jsp/app/login/login.xhtml + response: + body: + string: '' + headers: + Connection: + - Keep-Alive + Content-Length: + - '0' + Location: + - https://prepaid.dhl.com.mx/Prepago/jsp/app/login/login.xhtml + Server: + - BigIP + status: + code: 302 + message: Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Cookie: + - JSESSIONID=8A8EC9BCEEB5E9A146867958CC475746; BIGipServerpl_prepaid.com.mx_80=1029802396.20480.0000 + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: GET + uri: https://prepaid.dhl.com.mx/Prepago/jsp/app/login/login.xhtml + response: + body: + string: "\n\n\n \n \n Login\ + \ / Admin\n \n \n \n \n \n \n \n \n \n\ + \
\n \n
\n\n \n
\n
\n \ + \ \n
\n
\n \"DHL\n
\n
\n\ + \ \n\n \n\n \n
\n
\n
\n\n\n \ + \
\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\ +
Prepago\ + \ DHL
Debe autenticarse en el sistema para acceder
\n\n\n\n\n\n\ + \n\ + \n\n\n\n\n\ + \n\n\n
\n\n\n\n\n\ + \n\n\n\n\n\n
Usuario:
Contraseña:
\n
Recuperar Contraseña
\n\n\n\n\n\n\ + \n
\n
\n
\n
\n\n
\n
Recuperar Contraseña
\n
\n\n\n\n\n\n\n\n\n\n\n\n
Recuperación\ + \ de Contraseña
Usuario:
\n\"\
\"\"\n\n\n\n\n\n\n\ +
\n\n
new ModalPanel('pnlUsuario',\n\t\t\t\t{\n\t\t\t\ + \t\twidth: 400,\n\t\t\t\t\theight: 200,\n\n\t\t\t\t\tminWidth: -1,\n\t\t\t\ + \t\tminHeight: -1,\n\n\t\t\t\t\tresizeable: true,\n\t\t\t\t\tmoveable: true,\n\ + \n\t\t\t\t\tleft: \"auto\",\n\t\t\t\t\ttop: \"auto\",\n\n\t\t\t\t\tzindex:\ + \ 100,onresize: '',onmove: '',onshow: '',onhide: '',onbeforeshow: '',onbeforehide:\ + \ '',\n\t\t\t\t\tdomElementAttachment: \"\",\t\t\t\t\n\t\t\t\t\tkeepVisualState:\ + \ false,\n\t\t\t\t\tshowWhenRendered: false,\n\t\t\t\t\tselectBehavior: \"\ + disable\",\n\n\t\t\t\t\tautosized: false,\n\t\t\t\t\toverlapEmbedObjects:\ + \ false});
\n\ + \ \n \n \n\n \n \ + \ \n \n \n\n \n
\n \n \"Deutsche\n \n
\n\n \ + \ \n \n" + headers: + Content-Type: + - text/html;charset=UTF-8 + Date: + - Wed, 05 Feb 2020 14:22:26 GMT + Server: + - Apache-Coyote/1.1 + Set-Cookie: + - JSESSIONID=DED9B0B472206CC966610596EB9EB72F; Path=/Prepago/; HttpOnly + Transfer-Encoding: + - chunked + X-Powered-By: + - JSF/1.2 + status: + code: 200 + message: OK +version: 1 diff --git a/tests/resources/test_invalid_data.py b/tests/resources/test_invalid_data.py index 09625a7..c6e8ae5 100644 --- a/tests/resources/test_invalid_data.py +++ b/tests/resources/test_invalid_data.py @@ -5,7 +5,6 @@ @pytest.mark.vcr def test_invalid_destination(client, origin, invalid_destination, details): - with pytest.raises(DhlmexException) as execinfo: client.guides.create_guide(origin, invalid_destination, details) assert str(execinfo) == 'Error while creating guide' @@ -13,7 +12,13 @@ def test_invalid_destination(client, origin, invalid_destination, details): @pytest.mark.vcr def test_invalid_postal_code(client, origin, invalid_postal_code, details): - with pytest.raises(DhlmexException) as execinfo: client.guides.create_guide(origin, invalid_postal_code, details) assert str(execinfo.value) == 'Invalid destiny postal code' + + +@pytest.mark.vcr +def test_missing_city(client, origin, missing_data, details): + with pytest.raises(DhlmexException) as execinfo: + client.guides.create_guide(origin, missing_data, details) + assert str(execinfo.value) == 'Invalid value' diff --git a/tests/test_client_login.py b/tests/test_client_login.py index 226acba..45d3700 100644 --- a/tests/test_client_login.py +++ b/tests/test_client_login.py @@ -21,6 +21,14 @@ def test_successful_login(site_urls): assert 'Administrar' in soup.find('title').text +@pytest.mark.vcr +def test_invalid_creds(): + with pytest.raises(DhlmexException) as execinfo: + client = Client('invalidUsername', 'invalidPassword') + assert str(execinfo.value) == f'Invalid credentials' + assert client + + def test_debug_login(): os.environ['DEBUG'] = 'True' with pytest.raises(DhlmexException) as execinfo: @@ -30,6 +38,7 @@ def test_debug_login(): ) assert client.session.cert client._logout() + os.environ['DEBUG'] = '' @pytest.mark.vcr From 9011b59904b9d776f8cb28676958051b041d400b Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 5 Feb 2020 16:36:21 -0600 Subject: [PATCH 8/8] Remove redundant return and update version --- dhlmex/resources/guides.py | 4 ++-- dhlmex/version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dhlmex/resources/guides.py b/dhlmex/resources/guides.py index 24156ed..96fa1b2 100644 --- a/dhlmex/resources/guides.py +++ b/dhlmex/resources/guides.py @@ -136,11 +136,11 @@ def _fill_guide_table( def _validate_data(self, fill_data: Dict) -> str: resp = self._client.post(self._urls['capture'], fill_data) + msg = '' if 'messageError' in resp.text: soup = BeautifulSoup(resp.text, features='html.parser') msg = soup.find('span', {'class': 'rich-messages-label'}).text - return msg - return '' + return msg def _confirm_capture(self, view_state: str) -> Response: confirm_data = { diff --git a/dhlmex/version.py b/dhlmex/version.py index 971fbc4..4a197ec 100644 --- a/dhlmex/version.py +++ b/dhlmex/version.py @@ -1 +1 @@ -__version__ = '0.0.4' # pragma: no cover +__version__ = '0.0.5' # pragma: no cover