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