Skip to content
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 to protect login bug solution #5415

Closed
jywarren opened this issue Apr 8, 2019 · 5 comments · Fixed by #5579
Closed

Add test to protect login bug solution #5415

jywarren opened this issue Apr 8, 2019 · 5 comments · Fixed by #5579
Labels
help wanted requires help by anyone willing to contribute Ruby testing issues are usually for adding unit tests, integration tests or any other tests for a feature

Comments

@jywarren
Copy link
Member

jywarren commented Apr 8, 2019

#5410 was a great solution for the bug identified in #5405, but I'd like to write a test to prevent this from happening again. It could be a system test:

#5316

Or it could be an integration test, something like this:

# This test depend on question based search functionality
test 'search a question and go through post mechanism if question not found when user is not logged in' do
get '/post', params: { tags: 'question:question', template: 'question', title: 'What', redirect: 'question' }
follow_redirect!
assert_equal '/login', path
post '/user_sessions', params: { user_session: { username: users(:jeff).username, password: 'secretive' } }
follow_redirect!
assert_response :redirect
assert_redirected_to '/questions/new?tags=question%3Aquestion&template=question&title=What&redirect=question'

Basically we want to try logging in, like here:

https://github.com/publiclab/plots2/blob/master/test/integration/login_flow_test.rb#L22

but with the wrong password, then enter the right password, and show that it really redirects to the dashboard as the solution in #5410 changed.

For anyone looking to learn more about testing, this is a good one!!!

@jywarren jywarren added help wanted requires help by anyone willing to contribute Ruby testing issues are usually for adding unit tests, integration tests or any other tests for a feature labels Apr 8, 2019
@jywarren
Copy link
Member Author

jywarren commented Apr 8, 2019

@40404notfound would you be interested in this one at all? We'd love your help! Thanks again!

@VegChick2
Copy link
Contributor

@jywarren Sure! I am very glad to help.

@IshaGupta18
Copy link
Collaborator

@40404notfound how's the work going in on this one? Just checking in in case you are stuck!

@VegChick2
Copy link
Contributor

@IshaGupta18 Thanks a lot ! I just had an extremely busy week so I had to postpone my plan in fixing this issue. Don't worry. I am definitely going to fix this in a few days.

@VegChick2
Copy link
Contributor

Hi, @jywarren @IshaGupta18 , I just added a test case in #5579 for exposing the bug in #5410. The new test should be able to distinguish a buggy one from a correct one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted requires help by anyone willing to contribute Ruby testing issues are usually for adding unit tests, integration tests or any other tests for a feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants