0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-27 23:48:39 +01:00
gitea/tests
Infinoid 86ee5b4b1b
PATCH branch-protection updates check list even when checks are disabled (#26351)
Fixes: #26333.

Previously, this endpoint only updates the `StatusCheckContexts` field
when `EnableStatusCheck==true`, which makes it impossible to clear the
array otherwise.

This patch uses slice `nil`-ness to decide whether to update the list of
checks. The field is ignored when either the client explicitly passes in
a null, or just omits the field from the json ([which causes
`json.Unmarshal` to leave the struct field
unchanged](https://go.dev/play/p/Z2XHOILuB1Q)). I think this is a better
measure of intent than whether the `EnableStatusCheck` flag was set,
because it matches the semantics of other field types.

Also adds a test case. I noticed that [`testAPIEditBranchProtection`
only checks the branch
name](c1c83dbaec/tests/integration/api_branch_test.go (L68))
and no other fields, so I added some extra `GET` calls and specific
checks to make sure the fields are changing properly.

I added those checks the existing integration test; is that the right
place for it?
2023-08-24 05:36:04 +00:00
..
e2e Update minimum password length requirements (#25946) 2023-08-21 19:27:50 +00:00
fuzz
gitea-lfs-meta
gitea-repositories-meta Add commits dropdown in PR files view and allow commit by commit review (#25528) 2023-07-28 21:18:12 +02:00
integration PATCH branch-protection updates check list even when checks are disabled (#26351) 2023-08-24 05:36:04 +00:00
mssql.ini.tmpl Do not use deprecated log config options by default (#26592) 2023-08-20 01:05:29 +00:00
mysql8.ini.tmpl Do not use deprecated log config options by default (#26592) 2023-08-20 01:05:29 +00:00
mysql.ini.tmpl Do not use deprecated log config options by default (#26592) 2023-08-20 01:05:29 +00:00
pgsql.ini.tmpl Do not use deprecated log config options by default (#26592) 2023-08-20 01:05:29 +00:00
sqlite.ini.tmpl Do not use deprecated log config options by default (#26592) 2023-08-20 01:05:29 +00:00
test_utils.go Refactor tests (#26464) 2023-08-12 16:30:16 +00:00