mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-07 16:27:00 +02:00
Fix all bugs I found in the code
This commit is contained in:
1 parent
a5163fa5f2
commit
9c5b278622
9 files changed
+127
-106
No files matched your search
@@ -128,15 +128,17 @@ func TestActionsTokenPermissionsModes(t *testing.T) {
|
||||
|
||||
func testActionsTokenPermissionsMode(u *url.URL, mode string, expectReadOnly bool) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
// Update repository settings to the requested mode
|
||||
// Update repository settings to the requested mode
|
||||
if mode != "" {
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: "repo4", OwnerName: "user5"})
|
||||
require.NoError(t, repo.LoadUnits(t.Context()))
|
||||
actionsUnit := repo.MustGetUnit(t.Context(), unit_model.TypeActions)
|
||||
actionsUnit, err := repo.GetUnit(t.Context(), unit_model.TypeActions)
|
||||
require.NoError(t, err, "Actions unit should exist for repo4")
|
||||
actionsCfg := actionsUnit.ActionsConfig()
|
||||
actionsCfg.TokenPermissionMode = repo_model.ActionsTokenPermissionMode(mode)
|
||||
actionsCfg.DefaultTokenPermissions = nil // Ensure no custom permissions override the mode
|
||||
actionsCfg.MaxTokenPermissions = nil // Ensure no max permissions interfere
|
||||
// Update the config
|
||||
actionsUnit.Config = actionsCfg
|
||||
require.NoError(t, repo_model.UpdateRepoUnit(t.Context(), actionsUnit))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user