Switches the discovery version code bamboo -> cedar and aligns the open edition CLI with dws-wukong across communication (calendar book/acl/attendee, minutes tag, mail folder/template/contact, chat file upload, todo add-attachment, attendance transforms) and structured-office (aitable advperm/view/section/workflow/record, sheet/drive/wiki/doc) domains. Includes output-envelope parity, parse_bool/attendance_class_check_time transforms, --calendar-id support, CHANGELOG 1.0.43 and README command-index refresh. cedar config validated on pre and prod endpoints.
34 lines
1018 B
Go
34 lines
1018 B
Go
package cli_test
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/app"
|
|
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/cli"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
// Set an empty catalog fixture so that EnvironmentLoader does not
|
|
// attempt live discovery (which would hang on unreachable MCP endpoints).
|
|
absFixture, _ := filepath.Abs("testdata/empty_catalog.json")
|
|
os.Setenv(cli.CatalogFixtureEnv, absFixture)
|
|
|
|
// Serve the local servers.json fixture at /cli/discovery/apis/cedar so that
|
|
// the dynamic command generator can build CLI commands without network
|
|
// access. FetchServers calls {baseURL}/cli/discovery/apis/cedar.
|
|
mux := http.NewServeMux()
|
|
mux.HandleFunc("/cli/discovery/apis/cedar", func(w http.ResponseWriter, r *http.Request) {
|
|
http.ServeFile(w, r, "testdata/servers.json")
|
|
})
|
|
srv := httptest.NewServer(mux)
|
|
app.SetDiscoveryBaseURL(srv.URL)
|
|
|
|
code := m.Run()
|
|
srv.Close()
|
|
os.Exit(code)
|
|
}
|