MCPcopy Create free account
hub / github.com/anchordotdev/cli / TestCreateOrg

Function TestCreateOrg

org/create_test.go:28–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestCreateOrg(t *testing.T) {
29 ctx, cancel := context.WithCancel(context.Background())
30 defer cancel()
31
32 cfg := new(cli.Config)
33 cfg.API.URL = srv.URL
34 var err error
35 if cfg.API.Token, err = srv.GeneratePAT("anky@anchor.dev"); err != nil {
36 t.Fatal(err)
37 }
38 ctx = cli.ContextWithConfig(ctx, cfg)
39
40 t.Run("basics", func(t *testing.T) {
41 if srv.IsProxy() {
42 t.Skip("org create unsupported in proxy mode")
43 }
44
45 ctx, cancel := context.WithCancel(ctx)
46 defer cancel()
47
48 drv, tm := uitest.TestTUI(ctx, t)
49
50 cmd := Create{}
51
52 errc := make(chan error, 1)
53 go func() {
54 errc <- cmd.UI().RunTUI(ctx, drv)
55 errc <- tm.Quit()
56 }()
57
58 uitest.WaitForGoldenContains(t, drv, errc,
59 "? What is the new organization's name?",
60 )
61 tm.Send(tea.KeyMsg{
62 Runes: []rune("Org Name"),
63 Type: tea.KeyRunes,
64 })
65 tm.Send(tea.KeyMsg{Type: tea.KeyEnter})
66
67 tm.WaitFinished(t, teatest.WithFinalTimeout(time.Second*3))
68 uitest.TestGolden(t, drv.Golden())
69 })
70}

Callers

nothing calls this directly

Calls 12

UIMethod · 0.95
ContextWithConfigFunction · 0.92
TestTUIFunction · 0.92
WaitForGoldenContainsFunction · 0.92
TestGoldenFunction · 0.92
GeneratePATMethod · 0.80
IsProxyMethod · 0.80
SendMethod · 0.80
GoldenMethod · 0.80
RunMethod · 0.65
QuitMethod · 0.65
RunTUIMethod · 0.45

Tested by

no test coverage detected