mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix: address verified review findings (labels-milestones-time-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
21 files changed
+262
-47
No files matched your search
@@ -75,3 +75,22 @@ func TestMilestoneRejectsInvalidDeadlineBeforeRequests(t *testing.T) {
|
||||
_, err = service.Edit(context.Background(), 1, MilestoneOptions{Deadline: &invalid})
|
||||
require.ErrorContains(t, err, "invalid milestone deadline")
|
||||
}
|
||||
|
||||
func TestOrganizationArchivedLabelCreateFollowsUpWithPatch(t *testing.T) {
|
||||
var requests []string
|
||||
client := newTestClient(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
requests = append(requests, r.Method+" "+r.URL.Path+" "+string(body))
|
||||
// Gitea ignores is_archived on create and honors it on edit.
|
||||
archived := "false"
|
||||
if r.Method == http.MethodPatch {
|
||||
archived = "true"
|
||||
}
|
||||
_, _ = w.Write([]byte(`{"id":5,"name":"bug","is_archived":` + archived + `}`))
|
||||
}))
|
||||
name, archived := "bug", true
|
||||
label, err := (Labels{Client: client, Organization: "company"}).Create(context.Background(), LabelOptions{Name: &name, Archived: &archived})
|
||||
require.NoError(t, err)
|
||||
require.True(t, label.Archived)
|
||||
require.Equal(t, []string{`POST /api/v1/orgs/company/labels {"name":"bug","is_archived":true}`, `PATCH /api/v1/orgs/company/labels/5 {"is_archived":true}`}, requests)
|
||||
}
|
||||
Reference in new issue
Block a user