mattermost-community-enterp.../cmd/mmctl/commands/auth_e2e_test.go
Claude ec1f89217a Merge: Complete Mattermost Server with Community Enterprise
Full Mattermost server source with integrated Community Enterprise features.
Includes vendor directory for offline/air-gapped builds.

Structure:
- enterprise-impl/: Enterprise feature implementations
- enterprise-community/: Init files that register implementations
- enterprise/: Bridge imports (community_imports.go)
- vendor/: All dependencies for offline builds

Build (online):
  go build ./cmd/mattermost

Build (offline/air-gapped):
  go build -mod=vendor ./cmd/mattermost

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 23:59:07 +09:00

36 lines
1.5 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package commands
import (
"github.com/spf13/cobra"
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/printer"
)
func (s *MmctlE2ETestSuite) TestAuthLoginWithTrailingSlashInInstanceURL() {
s.SetupTestHelper().InitBasic()
s.Run("URL with trailing slash", func() {
// loginCmdf doesn't return an error in this case. It prints to stderr instead.
printer.Clean()
// cobra wont let us run a subcommand directly. When we try to `Execute`
// the subcommand, cobra executes the parent command.
// Instead of calling RootCmd, with its various subcommands and options,
// we duplicate part of the the LoginCmd here.
cmd := &cobra.Command{}
cmd.Flags().StringP("name", "n", "name", "Name for the credentials")
cmd.Flags().StringP("username", "u", s.th.BasicUser.Username, "Username for the credentials")
cmd.Flags().StringP("password", "p", s.th.BasicUser.Password, "Password for the credentials")
cmd.Flags().StringP("access-token", "a", "", "Access token to use instead of username/password")
cmd.Flags().StringP("mfa-token", "m", "", "MFA token for the credentials")
cmd.Flags().Bool("no-activate", false, "If present, it won't activate the credentials after login")
_ = loginCmdF(cmd, []string{s.th.Client.URL + "/"}) // add a trailing slash
errLines := printer.GetErrorLines()
s.Require().Lenf(errLines, 0, "expected no error, got %q", errLines)
})
}