-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add test for do not prompt when --no-input flag is given #7712
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.
Hello, thank you for this!
When writing a test like this, we want to make sure that both cases are as close to each other as possible. For that reason, we should first have a test that confirms that we DO prompt for login credentials normally. Then we should reuse almost everything from that test except this time pass --no-input
and then confirm that we DO NOT prompt for login credentials.
What I would do for this PR is use the same server setup that you already have but make this a positive test case and check that we actually prompt for login credentials. In a followup PR we can test the negative test case and then officially document and support the --no-input
flag.
@chrahunt are there any methods that can tell what is being displayed on the console, I tried to read all the tests, but could not find. |
capsys may be helpful. |
I think we also want to do this. :) |
@pradyunsg actually i was getting some dependency error when i was writing tests, so i rebased it and the issue was resolved :) Now, i am getting timeout error in running the tests, here is the code
Are there any methods i can use to automatically enter values for the username and password when the tests are being run. i think that's what causing the timeout error, it is requesting for username and password but nothing is being provided during the runtime. |
You can pass result = script.pip(*args, stdin="user\npass\n", expect_error=True) |
I was taking a look at this PR, and was able to come up with a a positive test case, where I was able to Will that be enough for testing the positive test case. Is it enough to check that the prompt for username appears in stdout as above? Or do we also want to provide username and password, and verify that the inputted username and password from stdout is what we provided? @sk-ip, If you are able to move this PR forward and get it merged with the negative test case, I can finish the second test case. Otherwise I am also happy to take this PR to the finish line myself, and then either create a new PR for the second test case, or use one PR for both. |
@deveshks thanks for this, you may go with adding both the test cases. I almost got lost with this... |
Thanks for the response. I will create a new PR adding both the test cases. I think you can also go ahead and close this PR if you want to 😊 |
References #7688