mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
The server module named github.com/hanzoai/team/server/v8 — a path that resolves to the retired workspace's repository, not this one — while server/public still published github.com/mattermost/mattermost/server/public. Both are github.com/hanzoteam/server/... now, which is where this code actually lives. That second half is what made the binary unbootable. Upstream's public path stayed claimed by upstream, mattermost-plugin-ai imported it, and the build linked public/model twice; public/plugin's gob.Register then ran twice under one name and panicked at init, before main. Reverting the rename traded the brand for a working binary. Rebranding the plugin alongside it needs no such trade: the agents fork is github.com/hanzoteam/agents/v2 against our public module, so no module named mattermost/mattermost is in the graph at all. Measured: `go list -deps ./cmd/mattermost` names exactly one public/model, and it is ours.
89 lines
2.3 KiB
Go
89 lines
2.3 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package commands
|
|
|
|
import (
|
|
"os"
|
|
"os/user"
|
|
"path/filepath"
|
|
|
|
"github.com/hanzoteam/server/server/v8/cmd/mmctl/printer"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func (s *MmctlUnitTestSuite) TestAuthList() {
|
|
originalUser := *currentUser
|
|
defer func() {
|
|
SetUser(&originalUser)
|
|
}()
|
|
|
|
tmp, errMkDir := os.MkdirTemp("", "mmctl-")
|
|
s.Require().NoError(errMkDir)
|
|
s.T().Cleanup(func() {
|
|
s.Require().NoError(os.RemoveAll(tmp))
|
|
})
|
|
|
|
testUser, err := user.Current()
|
|
s.Require().NoError(err)
|
|
testUser.HomeDir = tmp
|
|
SetUser(testUser)
|
|
viper.Set("config", filepath.Join(xdgConfigHomeVar, configParent, configFileName))
|
|
|
|
s.Run("short name", func() {
|
|
printer.Clean()
|
|
|
|
credentials := Credentials{
|
|
Name: "MyN",
|
|
Username: "Un",
|
|
AuthToken: "",
|
|
AuthMethod: "",
|
|
InstanceURL: "IURL",
|
|
Active: true,
|
|
}
|
|
|
|
err = CleanCredentials()
|
|
s.Require().NoError(err)
|
|
err = SaveCredentials(credentials)
|
|
s.Require().NoError(err)
|
|
|
|
errListCmdF := listCmdF(&cobra.Command{}, []string{})
|
|
s.Require().NoError(errListCmdF)
|
|
s.Require().Len(printer.GetErrorLines(), 0)
|
|
lines := printer.GetLines()
|
|
s.Require().Len(lines, 4)
|
|
s.Require().Contains(lines[2], "| * | MyN | Un | IURL |")
|
|
s.Require().Contains(lines[1], "|--------|------|----------|-------------|")
|
|
s.Require().Contains(lines[0], "| Active | Name | Username | InstanceURL |")
|
|
})
|
|
|
|
s.Run("normal name", func() {
|
|
printer.Clean()
|
|
|
|
credentials := Credentials{
|
|
Name: "MyName",
|
|
Username: "MyUsername",
|
|
AuthToken: "",
|
|
AuthMethod: "",
|
|
InstanceURL: "My Instance URL",
|
|
Active: true,
|
|
}
|
|
|
|
err = CleanCredentials()
|
|
s.Require().NoError(err)
|
|
err = SaveCredentials(credentials)
|
|
s.Require().NoError(err)
|
|
|
|
errListCmdF := listCmdF(&cobra.Command{}, []string{})
|
|
s.Require().NoError(errListCmdF)
|
|
s.Require().Len(printer.GetErrorLines(), 0)
|
|
lines := printer.GetLines()
|
|
s.Require().Len(lines, 4)
|
|
s.Require().Contains(lines[2], "| * | MyName | MyUsername | My Instance URL |")
|
|
s.Require().Contains(lines[1], "|--------|--------|------------|-----------------|")
|
|
s.Require().Contains(lines[0], "| Active | Name | Username | InstanceURL |")
|
|
})
|
|
}
|