-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #205: Add functionality to reset authentication token and logout #233
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikochiko
With respect to changes proposed in this PR:
4, Add functionality in set_token command to clear existing token with:
evalai set_token clear_token
The use of evalai set_token just to set the token. To put it in other words, responsibility set_token
is just to set the token. You are delegating it one more task to clear token using flag tokens. How about clear token only using logout
command? I am trying to use Single Responsibility Principal to explain this.
@vkartik97 Got it. Yes now that I think about it, it makes a lot of sense. I will make that change. |
@vkartik97 Any comments on the rest of the task? |
tests/test_auth_utils.py
Outdated
self.assertEqual(value, expected) | ||
|
||
@mock.patch("evalai.utils.auth.os.remove") | ||
def test_reset_user_auth_token_when_writing_to_file_fails(self, mock_remove): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikochiko What does this test signify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pushkalkatara this is the test for the case when file deleting fails. And oops I think I named it incorrectly 😕 . How about changing the name to test_reset_user_auth_token_when_token_file_removal_fails
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! 👍
test_reset_user_auth_token_when_writing_to_file_fails -> test_reset_user_auth_token_when_token_file_removal_fails
Address #205
Objective:
To allow user to easily log out (i.e. reset existing authentication token) from the command line.
Changes proposed:
reset_user_auth_token
function in auth utilsreset_user_auth_token
4, Add functionality inset_token
command to clear existing token with:Edit: Removed 4: functionality to clear existing token from set_token command.
@RishabhJain2018 @vkartik97 @Ram81 Please review.