@@ -8,13 +8,12 @@ import (
88 "github.com/google/go-cmp/cmp/cmpopts"
99 "github.com/google/uuid"
1010 "github.com/spf13/cobra"
11- "github.com/stackitcloud/stackit-sdk-go/services/intake"
12-
1311 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1412 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
1513 "github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
1614 "github.com/stackitcloud/stackit-cli/internal/pkg/types"
1715 "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
16+ intake "github.com/stackitcloud/stackit-sdk-go/services/intake/v1betaapi"
1817)
1918
2019// Define a unique key for the context to avoid collisions
4140 // testCtx dummy context for testing purposes
4241 testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
4342 // testClient mock API client
44- testClient = & intake.APIClient {}
43+ testClient = & intake.APIClient {
44+ DefaultAPI : & intake.DefaultAPIService {},
45+ }
4546 testProjectId = uuid .NewString ()
4647 testRunnerId = uuid .NewString ()
4748
@@ -107,22 +108,22 @@ func fixtureCreatePayload(mods ...func(payload *intake.CreateIntakePayload)) int
107108 authType := intake .CatalogAuthType (testCatalogAuthType )
108109 testPartitioningType := intake .PartitioningType (testCatalogPartitioning )
109110 payload := intake.CreateIntakePayload {
110- DisplayName : utils . Ptr ( testDisplayName ) ,
111- IntakeRunnerId : utils . Ptr ( testRunnerId ) ,
111+ DisplayName : testDisplayName ,
112+ IntakeRunnerId : testRunnerId ,
112113 Description : utils .Ptr (testDescription ),
113- Labels : utils . Ptr ( testLabels ) ,
114- Catalog : & intake.IntakeCatalog {
115- Uri : utils . Ptr ( testCatalogURI ) ,
116- Warehouse : utils . Ptr ( testCatalogWarehouse ) ,
114+ Labels : testLabels ,
115+ Catalog : intake.IntakeCatalog {
116+ Uri : testCatalogURI ,
117+ Warehouse : testCatalogWarehouse ,
117118 Namespace : utils .Ptr (testCatalogNamespace ),
118119 TableName : utils .Ptr (testCatalogTableName ),
119120 Partitioning : & testPartitioningType ,
120- PartitionBy : utils . Ptr ( testCatalogPartitionBy ) ,
121+ PartitionBy : testCatalogPartitionBy ,
121122 Auth : & intake.CatalogAuth {
122- Type : & authType ,
123+ Type : authType ,
123124 Dremio : & intake.DremioAuth {
124- TokenEndpoint : utils . Ptr ( testDremioTokenEndpoint ) ,
125- PersonalAccessToken : utils . Ptr ( testDremioToken ) ,
125+ TokenEndpoint : testDremioTokenEndpoint ,
126+ PersonalAccessToken : testDremioToken ,
126127 },
127128 },
128129 },
@@ -135,7 +136,7 @@ func fixtureCreatePayload(mods ...func(payload *intake.CreateIntakePayload)) int
135136
136137// fixtureRequest generates an API request for tests
137138func fixtureRequest (mods ... func (request * intake.ApiCreateIntakeRequest )) intake.ApiCreateIntakeRequest {
138- request := testClient .CreateIntake (testCtx , testProjectId , testRegion )
139+ request := testClient .DefaultAPI . CreateIntake (testCtx , testProjectId , testRegion )
139140 request = request .CreateIntakePayload (fixtureCreatePayload ())
140141 for _ , mod := range mods {
141142 mod (& request )
@@ -269,7 +270,7 @@ func TestBuildRequest(t *testing.T) {
269270 expectedRequest : fixtureRequest (func (request * intake.ApiCreateIntakeRequest ) {
270271 * request = (* request ).CreateIntakePayload (fixtureCreatePayload (func (payload * intake.CreateIntakePayload ) {
271272 authType := intake .CatalogAuthType ("none" )
272- payload .Catalog .Auth .Type = & authType
273+ payload .Catalog .Auth .Type = authType
273274 payload .Catalog .Auth .Dremio = nil
274275 }))
275276 }),
@@ -282,6 +283,7 @@ func TestBuildRequest(t *testing.T) {
282283 diff := cmp .Diff (request , tt .expectedRequest ,
283284 cmp .AllowUnexported (tt .expectedRequest ),
284285 cmpopts .EquateComparable (testCtx ),
286+ cmpopts .EquateComparable (testClient .DefaultAPI ),
285287 )
286288 if diff != "" {
287289 t .Fatalf ("Data does not match: %s" , diff )
@@ -306,7 +308,7 @@ func TestOutputResult(t *testing.T) {
306308 args : args {
307309 model : fixtureInputModel (),
308310 projectLabel : "my-project" ,
309- resp : & intake.IntakeResponse {Id : utils . Ptr ( "intake-id-123" ) },
311+ resp : & intake.IntakeResponse {Id : "intake-id-123" },
310312 },
311313 wantErr : false ,
312314 },
@@ -317,7 +319,7 @@ func TestOutputResult(t *testing.T) {
317319 model .Async = true
318320 }),
319321 projectLabel : "my-project" ,
320- resp : & intake.IntakeResponse {Id : utils . Ptr ( "intake-id-123" ) },
322+ resp : & intake.IntakeResponse {Id : "intake-id-123" },
321323 },
322324 wantErr : false ,
323325 },
@@ -327,7 +329,7 @@ func TestOutputResult(t *testing.T) {
327329 model : fixtureInputModel (func (model * inputModel ) {
328330 model .OutputFormat = print .JSONOutputFormat
329331 }),
330- resp : & intake.IntakeResponse {Id : utils . Ptr ( "intake-id-123" ) },
332+ resp : & intake.IntakeResponse {Id : "intake-id-123" },
331333 },
332334 wantErr : false ,
333335 },
0 commit comments