diff --git a/pytr/api.py b/pytr/api.py index 4822b0f..3a42f79 100644 --- a/pytr/api.py +++ b/pytr/api.py @@ -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): diff --git a/tests/test_api_urls.py b/tests/test_api_urls.py index 07c17e5..157c25e 100644 --- a/tests/test_api_urls.py +++ b/tests/test_api_urls.py @@ -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" @@ -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") @@ -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']}"