-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(utils.py): remove email verification
- Loading branch information
1 parent
728c7c1
commit c2ca852
Showing
2 changed files
with
23 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
from unittest.mock import Mock, PropertyMock, patch, ANY | ||
import click | ||
from click.testing import CliRunner | ||
|
@@ -14,22 +13,27 @@ def setUp(self): | |
self.maxDiff = None | ||
self.runner = CliRunner(mix_stderr=False) | ||
|
||
@unittest.skip("We are bypassing email verification for now") | ||
@patch("safety.auth.cli.fail_if_authenticated") | ||
@patch("safety.auth.cli.get_authorization_data") | ||
@patch("safety.auth.cli.process_browser_callback") | ||
def test_auth_calls_login(self, process_browser_callback, | ||
get_authorization_data, fail_if_authenticated): | ||
def test_auth_calls_login( | ||
self, process_browser_callback, get_authorization_data, fail_if_authenticated | ||
): | ||
auth_data = "https://safetycli.com", "initialState" | ||
get_authorization_data.return_value = auth_data | ||
process_browser_callback.return_value = {"email": "[email protected]", "name": "Safety User"} | ||
result = self.runner.invoke(cli, ['auth']) | ||
process_browser_callback.return_value = { | ||
"email": "[email protected]", | ||
"name": "Safety User", | ||
} | ||
result = self.runner.invoke(cli, ["auth"]) | ||
|
||
fail_if_authenticated.assert_called_once() | ||
get_authorization_data.assert_called_once() | ||
process_browser_callback.assert_called_once_with(auth_data[0], | ||
initial_state=auth_data[1], | ||
ctx=ANY, headless=False) | ||
process_browser_callback.assert_called_once_with( | ||
auth_data[0], initial_state=auth_data[1], ctx=ANY, headless=False | ||
) | ||
|
||
expected = [ | ||
"", | ||
"Redirecting your browser to log in; once authenticated, return here to start using Safety", | ||
|
@@ -42,8 +46,8 @@ def test_auth_calls_login(self, process_browser_callback, | |
"", | ||
"Can’t find the verification email? Login at", | ||
"`https://platform.safetycli.com/login/` to resend the verification email", | ||
"" | ||
"", | ||
] | ||
|
||
for res_line, exp_line in zip(result.stdout.splitlines(), expected): | ||
self.assertIn(exp_line, res_line) | ||
self.assertIn(exp_line, res_line) |