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

Function TestCreateWithRichParameters

cli/create_test.go:755–1180  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

753}
754
755func TestCreateWithRichParameters(t *testing.T) {
756 t.Parallel()
757
758 // Default parameters and their expected values.
759 params := []param{
760 {
761 name: "number_param",
762 ptype: "number",
763 value: "777",
764 mutable: true,
765 },
766 {
767 name: "string_param",
768 ptype: "string",
769 value: "qux",
770 mutable: true,
771 },
772 {
773 name: "bool_param",
774 // TODO: Setting the type breaks booleans. It claims the default is false
775 // but when you then accept this default it errors saying that the value
776 // must be true or false. For now, use a string.
777 ptype: "string",
778 value: "false",
779 mutable: true,
780 },
781 {
782 name: "immutable_string_param",
783 ptype: "string",
784 value: "i am eternal",
785 mutable: false,
786 },
787 }
788
789 type testContext struct {
790 client *codersdk.Client
791 member *codersdk.Client
792 owner codersdk.CreateFirstUserResponse
793 template codersdk.Template
794 workspaceName string
795 }
796
797 tests := []struct {
798 name string
799 // setup runs before the command is started and return arguments that will
800 // be appended to the create command.
801 setup func() []string
802 // handlePty optionally runs after the command is started. It should handle
803 // all expected prompts from the pty.
804 handlePty func(pty *ptytest.PTY)
805 // postRun runs after the command has finished but before the workspace is
806 // verified. It must return the workspace name to check (used for the copy
807 // workspace tests).
808 postRun func(t *testing.T, args testContext) string
809 // errors contains expected errors. The workspace will not be verified if
810 // errors are expected.
811 errors []string
812 // inputParameters overrides the default parameters.

Callers

nothing calls this directly

Calls 15

NewFunction · 0.92
SetupConfigFunction · 0.92
NewFunction · 0.92
CreateTemplateVersionFunction · 0.92
NewFunction · 0.92
CreateFirstUserFunction · 0.92
CreateAnotherUserFunction · 0.92
CreateTemplateFunction · 0.92
WriteLineMethod · 0.80

Tested by

no test coverage detected