MCPcopy Index your code
hub / github.com/coder/coder / setupKeyringTestEnv

Function setupKeyringTestEnv

cli/keyring_test.go:32–55  ·  view source on GitHub ↗
(t *testing.T, clientURL string, args ...string)

Source from the content-addressed store, hash-verified

30}
31
32func setupKeyringTestEnv(t *testing.T, clientURL string, args ...string) keyringTestEnv {
33 t.Helper()
34
35 var root cli.RootCmd
36
37 cmd, err := root.Command(root.AGPL())
38 require.NoError(t, err)
39
40 serviceName := testhelpers.KeyringServiceName(t)
41 root.WithKeyringServiceName(serviceName)
42 root.UseKeyringWithGlobalConfig()
43
44 inv, cfg := clitest.NewWithDefaultKeyringCommand(t, cmd, args...)
45
46 parsedURL, err := url.Parse(clientURL)
47 require.NoError(t, err)
48
49 backend := sessionstore.NewKeyringWithService(serviceName)
50 t.Cleanup(func() {
51 _ = backend.Delete(parsedURL)
52 })
53
54 return keyringTestEnv{serviceName, backend, inv, cfg, parsedURL}
55}
56
57func TestUseKeyring(t *testing.T) {
58 // Verify that the --use-keyring flag default opts into using a keyring backend

Callers 2

TestUseKeyringFunction · 0.85

Calls 11

CommandMethod · 0.95
AGPLMethod · 0.95
KeyringServiceNameFunction · 0.92
NewKeyringWithServiceFunction · 0.92
HelperMethod · 0.65
ParseMethod · 0.65
CleanupMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected