Skip to content

Don't fail silently if trying to add a collaborator twice #4533

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

Merged
merged 7 commits into from
Aug 7, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improvee testcases
  • Loading branch information
adelowo committed Aug 6, 2018
commit 61cb9b90a74a8de828c1bd4c92c255bf3e6bb41f
22 changes: 22 additions & 0 deletions routers/repo/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,27 @@ func TestCollaborationPost_InactiveUser(t *testing.T) {

assert.EqualValues(t, http.StatusFound, ctx.Resp.Status())
assert.NotEmpty(t, ctx.Flash.ErrorMsg)
}

func TestCollaborationPost_NonExistentUser(t *testing.T) {

models.PrepareTestEnv(t)
ctx := test.MockContext(t, "user2/repo1/issues/labels")
test.LoadUser(t, ctx, 2)
test.LoadRepo(t, ctx, 1)

ctx.Req.Form.Set("collaborator", "user34")

repo := &context.Repository{
Owner: &models.User{
LowerName: "user2",
},
}

ctx.Repo = repo

CollaborationPost(ctx)

assert.EqualValues(t, http.StatusFound, ctx.Resp.Status())
assert.NotEmpty(t, ctx.Flash.ErrorMsg)
}