mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix(team,repo,org,wiki,auth): detect a kept admin permission, validate topics up front, page public members, name disabled wikis, treat auth switch's account as --user
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
12 files changed
+289
-64
No files matched your search
@@ -860,3 +860,16 @@ func TestAuthLoginSSHKeyNeverAsksTheVersionOfAPrivateInstance(t *testing.T) {
|
||||
"auth", "login", "--host", server.URL, "--ssh-key", keyPath, "--no-input", "--yes",
|
||||
}))
|
||||
}
|
||||
|
||||
func TestAuthSwitchTreatsThePositionalAccountLikeUser(t *testing.T) {
|
||||
const instance = "https://example.org"
|
||||
deps, _, _ := terminalDeps(t)
|
||||
configureAccounts(t, deps, instance, "alice", "alice", "bob")
|
||||
err := Execute(context.Background(), deps, []string{"auth", "switch", "bob", "--user", "alice"})
|
||||
require.Equal(t, clierr.Usage, clierr.ExitCode(err), "%v", err)
|
||||
require.EqualError(t, err, "--user alice and the account bob differ")
|
||||
s, err := deps.Settings.Load()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "alice", s.Hosts.Hosts[instance].User)
|
||||
require.NoError(t, Execute(context.Background(), deps, []string{"auth", "switch", "BOB", "--user", "bob"}))
|
||||
}
|
||||
Reference in new issue
Block a user