-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sms mfa using str instead of int to keep leading zeros (#995)
- Loading branch information
1 parent
1aec515
commit 8015de7
Showing
7 changed files
with
473 additions
and
984 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,3 +195,42 @@ def test_2fa_flow_valid_code(self) -> None: | |
self._caplog.text, | ||
) | ||
assert result.exit_code == 0 | ||
|
||
def test_2fa_flow_valid_code_zero_lead(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
cookie_dir = os.path.join(base_dir, "cookie") | ||
|
||
for dir in [base_dir, cookie_dir]: | ||
recreate_path(dir) | ||
|
||
with vcr.use_cassette(os.path.join(self.vcr_path, "2fa_flow_valid_code_zero_lead.yml")): | ||
runner = CliRunner(env={"CLIENT_ID": "DE309E26-942E-11E8-92F5-14109FE0B321"}) | ||
result = runner.invoke( | ||
main, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--no-progress-bar", | ||
"--cookie-directory", | ||
cookie_dir, | ||
"--auth-only", | ||
], | ||
input="054321\n", | ||
) | ||
self.assertIn("DEBUG Authenticating...", self._caplog.text) | ||
self.assertIn( | ||
"INFO Two-factor authentication is required", | ||
self._caplog.text, | ||
) | ||
self.assertIn( | ||
"Please enter two-factor authentication code or device index (a) to send SMS with a code: 054321", | ||
result.output, | ||
) | ||
self.assertIn( | ||
"INFO Great, you're all set up. The script can now be run without " | ||
"user interaction until 2FA expires.", | ||
self._caplog.text, | ||
) | ||
assert result.exit_code == 0 |
Oops, something went wrong.