MCPcopy Index your code
hub / github.com/cli/cli / apiCreateDefaults

Function apiCreateDefaults

pkg/cmd/codespace/create_test.go:828–862  ·  view source on GitHub ↗
(c *apiClientMock)

Source from the content-addressed store, hash-verified

826}
827
828func apiCreateDefaults(c *apiClientMock) *apiClientMock {
829 if c.GetRepositoryFunc == nil {
830 c.GetRepositoryFunc = func(ctx context.Context, nwo string) (*api.Repository, error) {
831 return &api.Repository{
832 ID: 1234,
833 FullName: nwo,
834 DefaultBranch: "main",
835 }, nil
836 }
837 }
838 if c.GetCodespaceBillableOwnerFunc == nil {
839 c.GetCodespaceBillableOwnerFunc = func(ctx context.Context, nwo string) (*api.User, error) {
840 return &api.User{
841 Login: "monalisa",
842 Type: "User",
843 }, nil
844 }
845 }
846 if c.ListDevContainersFunc == nil {
847 c.ListDevContainersFunc = func(ctx context.Context, repoID int64, branch string, limit int) ([]api.DevContainerEntry, error) {
848 return []api.DevContainerEntry{{Path: ".devcontainer/devcontainer.json"}}, nil
849 }
850 }
851 if c.GetCodespacesMachinesFunc == nil {
852 c.GetCodespacesMachinesFunc = func(ctx context.Context, repoID int64, branch, location string, devcontainerPath string) ([]*api.Machine, error) {
853 return []*api.Machine{
854 {
855 Name: "GIGA",
856 DisplayName: "Gigabits of a machine",
857 },
858 }, nil
859 }
860 }
861 return c
862}
863
864func durationPtr(d time.Duration) *time.Duration {
865 return &d

Callers 1

TestApp_CreateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected