Skip to content

Commit 61cb9b9

Browse files
committed
improvee testcases
1 parent 6d36ff7 commit 61cb9b9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

routers/repo/settings_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,27 @@ func TestCollaborationPost_InactiveUser(t *testing.T) {
119119

120120
assert.EqualValues(t, http.StatusFound, ctx.Resp.Status())
121121
assert.NotEmpty(t, ctx.Flash.ErrorMsg)
122+
}
123+
124+
func TestCollaborationPost_NonExistentUser(t *testing.T) {
125+
126+
models.PrepareTestEnv(t)
127+
ctx := test.MockContext(t, "user2/repo1/issues/labels")
128+
test.LoadUser(t, ctx, 2)
129+
test.LoadRepo(t, ctx, 1)
130+
131+
ctx.Req.Form.Set("collaborator", "user34")
132+
133+
repo := &context.Repository{
134+
Owner: &models.User{
135+
LowerName: "user2",
136+
},
137+
}
138+
139+
ctx.Repo = repo
140+
141+
CollaborationPost(ctx)
122142

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

0 commit comments

Comments
 (0)