Add new API client function to tests

This commit is contained in:
Jake Shorty 2022-06-17 19:52:37 +00:00 committed by GitHub
parent 7e4ec074f5
commit 08446c8fcd

View file

@ -29,6 +29,12 @@ func TestApp_Create(t *testing.T) {
name: "create codespace with default branch and 30m idle timeout",
fields: fields{
apiClient: &apiClientMock{
GetCodespacePreFlightFunc: func(ctx context.Context, nwo string) (*api.User, error) {
return &api.User{
Login: "monalisa",
Type: "User",
}, nil
},
GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
return &api.Repository{
ID: 1234,
@ -83,6 +89,12 @@ func TestApp_Create(t *testing.T) {
GetCodespaceRegionLocationFunc: func(ctx context.Context) (string, error) {
return "EUROPE", nil
},
GetCodespacePreFlightFunc: func(ctx context.Context, nwo string) (*api.User, error) {
return &api.User{
Login: "monalisa",
Type: "User",
}, nil
},
GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
return &api.Repository{
ID: 1234,
@ -134,6 +146,12 @@ func TestApp_Create(t *testing.T) {
GetCodespaceRegionLocationFunc: func(ctx context.Context) (string, error) {
return "EUROPE", nil
},
GetCodespacePreFlightFunc: func(ctx context.Context, nwo string) (*api.User, error) {
return &api.User{
Login: "monalisa",
Type: "User",
}, nil
},
GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
return &api.Repository{
ID: 1234,
@ -190,6 +208,12 @@ func TestApp_Create(t *testing.T) {
GetCodespaceRegionLocationFunc: func(ctx context.Context) (string, error) {
return "EUROPE", nil
},
GetCodespacePreFlightFunc: func(ctx context.Context, nwo string) (*api.User, error) {
return &api.User{
Login: "monalisa",
Type: "User",
}, nil
},
GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
return &api.Repository{
ID: 1234,
@ -218,6 +242,12 @@ func TestApp_Create(t *testing.T) {
GetCodespaceRegionLocationFunc: func(ctx context.Context) (string, error) {
return "EUROPE", nil
},
GetCodespacePreFlightFunc: func(ctx context.Context, nwo string) (*api.User, error) {
return &api.User{
Login: "monalisa",
Type: "User",
}, nil
},
GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
return &api.Repository{
ID: 1234,
@ -268,6 +298,12 @@ func TestApp_Create(t *testing.T) {
name: "create codespace that requires accepting additional permissions",
fields: fields{
apiClient: &apiClientMock{
GetCodespacePreFlightFunc: func(ctx context.Context, nwo string) (*api.User, error) {
return &api.User{
Login: "monalisa",
Type: "User",
}, nil
},
GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
return &api.Repository{
ID: 1234,