Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pytr/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ def complete_weblogin(self, verify_code=None):
headers=self._login_headers(),
)
self._raise_for_login_error(r)
else:
self._await_weblogin_confirmation()

self._await_weblogin_confirmation()
self.save_websession()

def _raise_for_login_error(self, r):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_api_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_initiate_weblogin_rejects_a_null_process_id():


def test_complete_weblogin_posts_code_to_authenticator_verification():
tr = _api([{}])
tr = _api([{}, {"status": "CONFIRMED"}])
tr._process_id = "pid-1"
tr._required_action = "AUTHENTICATOR_VERIFICATION"

Expand Down Expand Up @@ -220,7 +220,7 @@ def _every_login_call():
poll.initiate_weblogin()
poll.complete_weblogin(None)

verify = _api([{}])
verify = _api([{}, {"status": "CONFIRMED"}])
verify._process_id = "pid-1"
verify._required_action = "AUTHENTICATOR_VERIFICATION"
verify.complete_weblogin("123456")
Expand All @@ -232,7 +232,7 @@ def test_every_v2_login_call_sends_the_required_headers():
"""Without them Trade Republic answers 400 MISSING_REQUIRED_HEADER."""
calls = _every_login_call()

assert [c["url"] for c in calls] == [LOGIN, PROCESS, PROCESS, f"{PROCESS}/authenticator-verification"]
assert [c["url"] for c in calls] == [LOGIN, PROCESS, PROCESS, f"{PROCESS}/authenticator-verification", PROCESS]
for call in calls:
for header in REQUIRED_HEADERS:
assert call["headers"].get(header), f"{header} missing on {call['method']} {call['url']}"
Expand Down
Loading