| 826 | } |
| 827 | |
| 828 | func 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 | |
| 864 | func durationPtr(d time.Duration) *time.Duration { |
| 865 | return &d |