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 integration test for signup #1135

Merged
merged 6 commits into from
Mar 11, 2017
Merged

Conversation

typeless
Copy link
Contributor

@typeless typeless commented Mar 7, 2017

Add integration test for signup.

For #63

@lunny lunny added this to the 1.2.0 milestone Mar 7, 2017
@appleboy
Copy link
Member

appleboy commented Mar 9, 2017

build fails

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 9, 2017
@typeless
Copy link
Contributor Author

typeless commented Mar 9, 2017

@appleboy Fixed now.

@strk
Copy link
Member

strk commented Mar 9, 2017

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 9, 2017
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package integration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should move this file to routers/user/ folder and rename to auth_test.go ?

Copy link
Contributor Author

@typeless typeless Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The motivation that led me to this way is that it depends on /install and some housekeeping works (creating tempdir, launching the program ... etc.). Imaging that we are testing 'merging a pull-request', We have to

  1. Set up a Gitea server from /install
  2. Signup a user
  3. Create a repo
  4. Push a prepared repo to Gitea
  5. Signup another user
  6. Fork the repo on Gitea
  7. Clone it
  8. Make some changes to the cloned code, commit them and push them back
  9. Create a pull request
  10. Push the 'merge' button

That's what I had to do manually to test it reliably without depending on certain kept states.
Otherwise, I'd also go for the idiomatic unit test scheme.

Edit: Another approach is to prepare set-up Gitea environments and just relying on them. That could be a good idea as well. I will think about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can have an hibrid approach: we'd have an "integration" package that would have the setup and cleanup logic, but the tests itself would be on the router packages.

There's one more thing I'd change: Go routers like Macaron have an ServeHTTP method, which can be used to simulate HTTP requests created in tests. So no need to run Gitea in a port and do a real request through the network.

These are ideas, we're totally open to discussion. =)

@lunny
Copy link
Member

lunny commented Mar 10, 2017

I will give this LGTM even there are some improvements. but this is a good beginning.

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 10, 2017
@strk
Copy link
Member

strk commented Mar 11, 2017

LGTM

@lunny lunny merged commit bdcc1a2 into go-gitea:master Mar 11, 2017
@typeless typeless deleted the test-signup-v2 branch April 3, 2019 04:59
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants