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

bug fixed for API to get user's repos #1622

Merged
merged 3 commits into from
Apr 29, 2017

Conversation

lunny
Copy link
Member

@lunny lunny commented Apr 27, 2017

As title. Will fix #1540. And how to test APIs? Maybe we need a framework like intergration test to do that?

@lunny lunny added the type/bug label Apr 27, 2017
@lunny lunny added this to the 1.2.0 milestone Apr 27, 2017
@sapk
Copy link
Member

sapk commented Apr 27, 2017

LGTM

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 27, 2017
@@ -9,7 +9,7 @@ import (
// listUserRepos - List the repositories owned by the given user.
func listUserRepos(ctx *context.APIContext, u *models.User) {
userID := u.ID
showPrivateRepos := (ctx.User.ID == userID || ctx.User.IsAdmin) && ctx.IsSigned
showPrivateRepos := ctx.IsSigned && (ctx.User.ID == userID || ctx.User.IsAdmin)
Copy link
Contributor

@cez81 cez81 Apr 27, 2017

Choose a reason for hiding this comment

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

@sapk
Copy link
Member

sapk commented Apr 27, 2017

For testing you can make integration test and request the API directly ?

@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 Apr 27, 2017
@bkcsoft
Copy link
Member

bkcsoft commented Apr 27, 2017

@lunny could you fix #1539 at the same time? (same bug really)

@lunny
Copy link
Member Author

lunny commented Apr 27, 2017

@sapk I have added a test
@bkcsoft I have sent #1624 to fix #1539

@sapk
Copy link
Member

sapk commented Apr 27, 2017

@lunny Perfect. Still LGTM for me ^^

@bkcsoft
Copy link
Member

bkcsoft commented Apr 27, 2017

LGTM

@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 Apr 27, 2017
func TestAPIUserReposNotLogin(t *testing.T) {
assert.NoError(t, models.LoadFixtures())

req, err := http.NewRequest("GET", "/api/v1/users/user1/repos", nil)
Copy link
Member

@sapk sapk Apr 27, 2017

Choose a reason for hiding this comment

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

user1 don't have repos in mock value so maybe we could also test user2 repo listing?

https://github.com/go-gitea/gitea/blob/master/models/fixtures/repository.yml

@lunny
Copy link
Member Author

lunny commented Apr 27, 2017

waiting for #1627

@lunny
Copy link
Member Author

lunny commented Apr 29, 2017

let L-G-T-M work

@lunny lunny merged commit 61b08b5 into go-gitea:master Apr 29, 2017
@lunny lunny deleted the lunny/fix_api_user_repos branch April 29, 2017 04:33
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 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/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic when listing user repos using API and not authenticated
5 participants