MCPcopy
hub / github.com/kopia/kopia / TestCLIAPI

Function TestCLIAPI

internal/server/api_cli_test.go:15–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestCLIAPI(t *testing.T) {
16 ctx, env := repotesting.NewEnvironment(t, repotesting.FormatNotImportant)
17 srvInfo := servertesting.StartServer(t, env, false)
18
19 cli, err := apiclient.NewKopiaAPIClient(apiclient.Options{
20 BaseURL: srvInfo.BaseURL,
21 TrustedServerCertificateFingerprint: srvInfo.TrustedServerCertificateFingerprint,
22 Username: servertesting.TestUIUsername,
23 Password: servertesting.TestUIPassword,
24 })
25
26 require.NoError(t, err)
27 require.NoError(t, cli.FetchCSRFTokenForTesting(ctx))
28
29 resp := &serverapi.CLIInfo{}
30 require.NoError(t, cli.Get(ctx, "cli", nil, resp))
31
32 exe, _ := os.Executable()
33
34 require.Equal(t, exe+" --config-file="+env.ConfigFile(), resp.Executable)
35}

Callers

nothing calls this directly

Calls 7

GetMethod · 0.95
NewEnvironmentFunction · 0.92
StartServerFunction · 0.92
NewKopiaAPIClientFunction · 0.92
EqualMethod · 0.80
ConfigFileMethod · 0.80

Tested by

no test coverage detected