mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
test: share the first-page and clock helpers
writeFirstPage answers paged listings in app and services tests, testNow replaces the copied clock, withoutANSI the second color stripper, and the single-entry table test becomes a plain test. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
23 files changed
+66
-105
No files matched your search
@@ -82,11 +82,7 @@ func TestIssueEditAddAndRemoveLabels(t *testing.T) {
|
||||
case r.URL.Path == "/api/v1/orgs/alice":
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
case r.URL.Path == "/api/v1/repos/alice/project/labels":
|
||||
if r.URL.Query().Get("page") != "1" {
|
||||
_, _ = w.Write([]byte(`[]`))
|
||||
return
|
||||
}
|
||||
_, _ = w.Write([]byte(`[{"id":1,"name":"bug"},{"id":2,"name":"docs"},{"id":3,"name":"help"}]`))
|
||||
writeFirstPage(w, r, `[{"id":1,"name":"bug"},{"id":2,"name":"docs"},{"id":3,"name":"help"}]`)
|
||||
case r.Method == http.MethodGet && r.URL.Path == "/api/v1/repos/alice/project/issues/7":
|
||||
_, _ = w.Write([]byte(`{"number":7,"labels":[{"id":1,"name":"bug"},{"id":2,"name":"docs"}]}`))
|
||||
case r.Method == http.MethodPut && r.URL.Path == "/api/v1/repos/alice/project/issues/7/labels":
|
||||
|
||||
Reference in new issue
Block a user