diff --git a/cli/app.go b/cli/app.go index 979d05e228a..aa4590f1dbc 100644 --- a/cli/app.go +++ b/cli/app.go @@ -119,13 +119,6 @@ const ( packageFlagFramework = "model-framework" - // TODO: APP-6993 remove these flags. - authApplicationFlagName = "application-name" - authApplicationFlagApplicationID = "application-id" - authApplicationFlagOriginURIs = "origin-uris" - authApplicationFlagRedirectURIs = "redirect-uris" - authApplicationFlagLogoutURI = "logout-uri" - oauthAppFlagClientID = "client-id" oauthAppFlagClientName = "client-name" oauthAppFlagClientAuthentication = "client-authentication" @@ -2755,106 +2748,6 @@ This won't work unless you have an existing installation of our GitHub app on yo }, }, }, - { - Name: "auth-app", - Usage: "manage third party auth applications", - UsageText: createUsageText("auth-app", nil, false, true), - HideHelpCommand: true, - Subcommands: []*cli.Command{ - { - Name: "register", - Usage: "register a third party auth application", - UsageText: createUsageText("auth-app register", - []string{ - generalFlagOrgID, authApplicationFlagName, authApplicationFlagOriginURIs, - authApplicationFlagRedirectURIs, authApplicationFlagLogoutURI, - }, false, false), - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: generalFlagOrgID, - Usage: "organization ID that will be tied to auth application", - Required: true, - }, - &cli.StringFlag{ - Name: authApplicationFlagName, - Usage: "name for the auth application", - Required: true, - }, - &cli.StringSliceFlag{ - Name: authApplicationFlagOriginURIs, - Usage: "origin uris for the auth application", - Required: true, - }, - &cli.StringSliceFlag{ - Name: authApplicationFlagRedirectURIs, - Usage: "redirect uris for the auth application", - Required: true, - }, - &cli.StringFlag{ - Name: authApplicationFlagLogoutURI, - Usage: "logout uri for the auth application", - Required: true, - }, - }, - Action: createCommandWithT[registerAuthApplicationArgs](RegisterAuthApplicationAction), - }, - { - Name: "update", - Usage: "update a third party auth application", - UsageText: createUsageText( - "auth-app update", []string{generalFlagOrgID, authApplicationFlagApplicationID, authApplicationFlagName}, false, false, - ), - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: generalFlagOrgID, - Required: true, - Usage: "organization ID that will be tied to auth application", - }, - &cli.StringFlag{ - Name: authApplicationFlagApplicationID, - Usage: "id for the auth application", - Required: true, - }, - &cli.StringFlag{ - Name: authApplicationFlagName, - Usage: "updated name for the auth application", - Required: true, - }, - &cli.StringSliceFlag{ - Name: authApplicationFlagOriginURIs, - Usage: "updated origin uris for the auth application", - }, - &cli.StringSliceFlag{ - Name: authApplicationFlagRedirectURIs, - Usage: "updated redirect uris for the auth application", - }, - &cli.StringFlag{ - Name: authApplicationFlagLogoutURI, - Usage: "updated logout uri for the auth application", - }, - }, - Action: createCommandWithT[updateAuthApplicationArgs](UpdateAuthApplicationAction), - }, - { - Name: "get", - Usage: "get configuration for a third party auth application", - UsageText: createUsageText("auth-app get", []string{generalFlagOrgID, authApplicationFlagApplicationID}, false, false), - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: generalFlagOrgID, - Required: true, - Usage: "organization ID that will be tied to auth application", - }, - &cli.StringFlag{ - Name: authApplicationFlagApplicationID, - Usage: "id for the auth application", - Required: true, - }, - }, - Action: createCommandWithT[getAuthApplicationArgs](GetAuthApplicationAction), - }, - }, - }, { Name: "version", Usage: "print version info for this program", diff --git a/cli/auth.go b/cli/auth.go index f26e0433b11..c35c04d7bfe 100644 --- a/cli/auth.go +++ b/cli/auth.go @@ -543,7 +543,6 @@ func (c *viamClient) ensureLoggedInInner() error { c.dataClient = datapb.NewDataServiceClient(conn) c.packageClient = packagepb.NewPackageServiceClient(conn) c.datasetClient = datasetpb.NewDatasetServiceClient(conn) - c.endUserClient = apppb.NewEndUserServiceClient(conn) c.mlTrainingClient = mltrainingpb.NewMLTrainingServiceClient(conn) c.buildClient = buildpb.NewBuildServiceClient(conn) diff --git a/cli/auth_application.go b/cli/auth_application.go deleted file mode 100644 index ebcedb8219d..00000000000 --- a/cli/auth_application.go +++ /dev/null @@ -1,155 +0,0 @@ -package cli - -import ( - "encoding/json" - - "github.com/urfave/cli/v2" - apppb "go.viam.com/api/app/v1" -) - -type registerAuthApplicationArgs struct { - OrgID string - ApplicationName string - OriginURIs []string - RedirectURIs []string - LogoutURI string -} - -// RegisterAuthApplicationAction is the corresponding action for 'auth-app register'. -func RegisterAuthApplicationAction(c *cli.Context, args registerAuthApplicationArgs) error { - client, err := newViamClient(c) - if err != nil { - return err - } - - return client.registerAuthApplicationAction(c, args) -} - -func (c *viamClient) registerAuthApplicationAction(cCtx *cli.Context, args registerAuthApplicationArgs) error { - if err := c.ensureLoggedIn(); err != nil { - return err - } - - orgID := args.OrgID - applicationName := args.ApplicationName - originURIs := args.OriginURIs - redirectURIs := args.RedirectURIs - logoutURI := args.LogoutURI - - req := &apppb.RegisterAuthApplicationRequest{ - OrgId: orgID, - ApplicationName: applicationName, - OriginUris: originURIs, - RedirectUris: redirectURIs, - LogoutUri: logoutURI, - } - resp, err := c.endUserClient.RegisterAuthApplication(c.c.Context, req) - if err != nil { - return err - } - - infof(cCtx.App.Writer, "Successfully registered auth application") - formatOutput, err := json.MarshalIndent(resp, "", "\t") - if err != nil { - return err - } - printf(cCtx.App.Writer, "%s", formatOutput) - warningf(cCtx.App.Writer, "Keep this information somewhere safe; "+ - "it contains the secret to your auth application") - return nil -} - -type updateAuthApplicationArgs struct { - OrgID string - ApplicationID string - ApplicationName string - OriginURIs []string - RedirectURIs []string - LogoutURI string -} - -// UpdateAuthApplicationAction is the corresponding action for 'auth-app update'. -func UpdateAuthApplicationAction(c *cli.Context, args updateAuthApplicationArgs) error { - client, err := newViamClient(c) - if err != nil { - return err - } - - return client.updateAuthApplicationAction(c, args) -} - -func (c *viamClient) updateAuthApplicationAction(cCtx *cli.Context, args updateAuthApplicationArgs) error { - if err := c.ensureLoggedIn(); err != nil { - return err - } - - orgID := args.OrgID - applicationID := args.ApplicationID - applicationName := args.ApplicationName - originURIs := args.OriginURIs - redirectURIs := args.RedirectURIs - logoutURI := args.LogoutURI - - req := &apppb.UpdateAuthApplicationRequest{ - OrgId: orgID, - ApplicationId: applicationID, - ApplicationName: applicationName, - OriginUris: originURIs, - RedirectUris: redirectURIs, - LogoutUri: logoutURI, - } - resp, err := c.endUserClient.UpdateAuthApplication(c.c.Context, req) - if err != nil { - return err - } - - infof(cCtx.App.Writer, "Successfully updated auth application") - formatOutput, err := json.MarshalIndent(resp, "", "\t") - if err != nil { - return err - } - printf(cCtx.App.Writer, "%s", formatOutput) - return nil -} - -type getAuthApplicationArgs struct { - OrgID string - ApplicationID string -} - -// GetAuthApplicationAction is the corresponding action for 'auth-app get'. -func GetAuthApplicationAction(c *cli.Context, args getAuthApplicationArgs) error { - client, err := newViamClient(c) - if err != nil { - return err - } - - return client.getAuthApplicationAction(c, args) -} - -func (c *viamClient) getAuthApplicationAction(cCtx *cli.Context, args getAuthApplicationArgs) error { - if err := c.ensureLoggedIn(); err != nil { - return err - } - - orgID := args.OrgID - applicationID := args.ApplicationID - - req := &apppb.GetAuthApplicationRequest{ - OrgId: orgID, - ApplicationId: applicationID, - } - resp, err := c.endUserClient.GetAuthApplication(c.c.Context, req) - if err != nil { - return err - } - - formatOutput, err := json.MarshalIndent(resp, "", "\t") - if err != nil { - return err - } - printf(cCtx.App.Writer, "%s", formatOutput) - warningf(cCtx.App.Writer, "Keep this information somewhere safe; "+ - "it contains the secret to your auth application") - return nil -} diff --git a/cli/auth_application_test.go b/cli/auth_application_test.go deleted file mode 100644 index a632623ae7e..00000000000 --- a/cli/auth_application_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package cli - -import ( - "context" - "testing" - - apppb "go.viam.com/api/app/v1" - "go.viam.com/test" - "google.golang.org/grpc" - - "go.viam.com/rdk/testutils/inject" -) - -func TestRegisterAuthApplicationAction(t *testing.T) { - registerAuthApplicationFunc := func(ctx context.Context, in *apppb.RegisterAuthApplicationRequest, - opts ...grpc.CallOption, - ) (*apppb.RegisterAuthApplicationResponse, error) { - return &apppb.RegisterAuthApplicationResponse{ - ApplicationId: "c6215428-1b73-41c3-b44a-56db0631c8f1", - ApplicationName: in.ApplicationName, - ClientSecret: "reallysecretsecret", - }, nil - } - - eusc := &inject.EndUserServiceClient{ - RegisterAuthApplicationFunc: registerAuthApplicationFunc, - } - flags := make(map[string]any) - flags[generalFlagOrgID] = "a757fe30-5648-4c5b-ab74-4ecd6bf06e4c" - flags[authApplicationFlagName] = "pupper_app" - flags[authApplicationFlagOriginURIs] = []string{"https://woof.com/login", "https://arf.com/"} - flags[authApplicationFlagRedirectURIs] = []string{"https://woof.com/home", "https://arf.com/home"} - flags[authApplicationFlagLogoutURI] = "https://woof.com/logout" - - cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, nil, nil, eusc, flags, "token") - err := ac.registerAuthApplicationAction(cCtx, parseStructFromCtx[registerAuthApplicationArgs](cCtx)) - test.That(t, err, test.ShouldBeNil) - test.That(t, len(errOut.messages), test.ShouldEqual, 0) - test.That(t, len(out.messages), test.ShouldEqual, 5) - - expectedResponseString := "{\n\t\"application_id\": \"c6215428-1b73-41c3-b44a-56db0631c8f1\"," + - "\n\t\"application_name\": \"pupper_app\",\n\t\"client_secret\": \"reallysecretsecret\"\n}\n" - test.That(t, out.messages[2], test.ShouldEqual, expectedResponseString) -} - -func TestUpdateAuthApplicationAction(t *testing.T) { - updateAuthApplication := func(ctx context.Context, in *apppb.UpdateAuthApplicationRequest, - opts ...grpc.CallOption, - ) (*apppb.UpdateAuthApplicationResponse, error) { - return &apppb.UpdateAuthApplicationResponse{ - ApplicationId: "c6215428-1b73-41c3-b44a-56db0631c8f1", - ApplicationName: in.ApplicationName, - }, nil - } - - eusc := &inject.EndUserServiceClient{ - UpdateAuthApplicationFunc: updateAuthApplication, - } - flags := make(map[string]any) - flags[generalFlagOrgID] = "a757fe30-5648-4c5b-ab74-4ecd6bf06e4c" - flags[authApplicationFlagApplicationID] = "a673022c-9916-4238-b8eb-4f7a89885909" - flags[authApplicationFlagName] = "pupper_app" - flags[authApplicationFlagOriginURIs] = []string{"https://woof.com/login", "https://arf.com/"} - flags[authApplicationFlagRedirectURIs] = []string{"https://woof.com/home", "https://arf.com/home"} - flags[authApplicationFlagLogoutURI] = "https://woof.com/logout" - - cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, nil, nil, eusc, flags, "token") - err := ac.updateAuthApplicationAction(cCtx, parseStructFromCtx[updateAuthApplicationArgs](cCtx)) - test.That(t, err, test.ShouldBeNil) - test.That(t, len(errOut.messages), test.ShouldEqual, 0) - test.That(t, len(out.messages), test.ShouldEqual, 3) - - expectedResponseString := "{\n\t\"application_id\": \"c6215428-1b73-41c3-b44a-56db0631c8f1\"," + - "\n\t\"application_name\": \"pupper_app\"\n}\n" - test.That(t, out.messages[2], test.ShouldEqual, expectedResponseString) -} - -func TestGetAuthApplicationAction(t *testing.T) { - getAuthApplication := func(ctx context.Context, in *apppb.GetAuthApplicationRequest, - opts ...grpc.CallOption, - ) (*apppb.GetAuthApplicationResponse, error) { - return &apppb.GetAuthApplicationResponse{ - ApplicationId: "c6215428-1b73-41c3-b44a-56db0631c8f1", - ApplicationName: "my_app", - ClientSecret: "supersupersecretsecret", - OriginUris: []string{"https://woof.com/login", "https://arf.com/"}, - RedirectUris: []string{"https://woof.com/home", "https://arf.com/home"}, - LogoutUri: "https://woof.com/logout", - }, nil - } - - eusc := &inject.EndUserServiceClient{ - GetAuthApplicationFunc: getAuthApplication, - } - flags := make(map[string]any) - flags[generalFlagOrgID] = "a757fe30-5648-4c5b-ab74-4ecd6bf06e4c" - flags[authApplicationFlagApplicationID] = "a673022c-9916-4238-b8eb-4f7a89885909" - - cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, nil, nil, eusc, flags, "token") - err := ac.getAuthApplicationAction(cCtx, parseStructFromCtx[getAuthApplicationArgs](cCtx)) - test.That(t, err, test.ShouldBeNil) - test.That(t, len(errOut.messages), test.ShouldEqual, 0) - test.That(t, len(out.messages), test.ShouldEqual, 3) - - expectedResponseString := "{\n\t\"" + - "application_id\": \"c6215428-1b73-41c3-b44a-56db0631c8f1\"," + - "\n\t\"application_name\": \"my_app\"," + - "\n\t\"client_secret\": \"supersupersecretsecret\"," + - "\n\t\"origin_uris\": [\n\t\t\"https://woof.com/login\"," + - "\n\t\t\"https://arf.com/\"\n\t]," + - "\n\t\"redirect_uris\": [\n\t\t\"https://woof.com/home\",\n\t\t\"https://arf.com/home\"\n\t]," + - "\n\t\"logout_uri\": \"https://woof.com/logout\"\n}\n" - test.That(t, out.messages[0], test.ShouldEqual, expectedResponseString) -} diff --git a/cli/auth_test.go b/cli/auth_test.go index 22b8dcd5c15..57a9cc516d9 100644 --- a/cli/auth_test.go +++ b/cli/auth_test.go @@ -16,7 +16,7 @@ import ( ) func TestLoginAction(t *testing.T) { - cCtx, ac, out, errOut := setup(nil, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(nil, nil, nil, nil, "token") test.That(t, ac.loginAction(cCtx), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -26,7 +26,7 @@ func TestLoginAction(t *testing.T) { } func TestAPIKeyAuth(t *testing.T) { - _, ac, _, errOut := setup(nil, nil, nil, nil, nil, "apiKey") + _, ac, _, errOut := setup(nil, nil, nil, nil, "apiKey") test.That(t, len(errOut.messages), test.ShouldEqual, 0) APIKey, isAPIKey := ac.conf.Auth.(*apiKey) test.That(t, isAPIKey, test.ShouldBeTrue) @@ -36,7 +36,7 @@ func TestAPIKeyAuth(t *testing.T) { func TestPrintAccessTokenAction(t *testing.T) { // AppServiceClient needed for any Action that calls ensureLoggedIn. - cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, nil, nil, nil, "token") test.That(t, ac.printAccessTokenAction(cCtx), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -53,7 +53,7 @@ func TestAPIKeyCreateAction(t *testing.T) { asc := &inject.AppServiceClient{ CreateKeyFunc: createKeyFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.organizationsAPIKeyCreateAction(cCtx, parseStructFromCtx[organizationsAPIKeyCreateArgs](cCtx)), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -80,7 +80,7 @@ func TestRobotAPIKeyCreateAction(t *testing.T) { flags[generalFlagOrgID] = fakeOrgID flags[generalFlagMachineID] = fakeRobotID flags[generalFlagName] = "my-name" - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, flags, "token") test.That(t, ac.robotAPIKeyCreateAction(cCtx, parseStructFromCtx[robotAPIKeyCreateArgs](cCtx)), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -135,7 +135,7 @@ func TestRobotAPIKeyCreateAction(t *testing.T) { flags[generalFlagMachineID] = fakeRobotID flags[generalFlagOrgID] = "" flags[generalFlagName] = "test-me" - cCtx, ac, out, _ = setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, _ = setup(asc, nil, nil, flags, "token") err = ac.robotAPIKeyCreateAction(cCtx, parseStructFromCtx[robotAPIKeyCreateArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) @@ -162,7 +162,7 @@ func TestLocationAPIKeyCreateAction(t *testing.T) { flags[generalFlagOrgID] = "" flags[generalFlagName] = "" // testing no locationID - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, flags, "token") err := ac.locationAPIKeyCreateAction(cCtx, parseStructFromCtx[locationAPIKeyCreateArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -203,7 +203,7 @@ func TestLocationAPIKeyCreateAction(t *testing.T) { flags[generalFlagOrgID] = "" flags[generalFlagName] = "test-name" - cCtx, ac, _, _ = setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, _, _ = setup(asc, nil, nil, flags, "token") err = ac.locationAPIKeyCreateAction(cCtx, parseStructFromCtx[locationAPIKeyCreateArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) @@ -212,7 +212,7 @@ func TestLocationAPIKeyCreateAction(t *testing.T) { } func TestLogoutAction(t *testing.T) { - cCtx, ac, out, errOut := setup(nil, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(nil, nil, nil, nil, "token") test.That(t, ac.logoutAction(cCtx), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -222,7 +222,7 @@ func TestLogoutAction(t *testing.T) { } func TestWhoAmIAction(t *testing.T) { - cCtx, ac, out, errOut := setup(nil, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(nil, nil, nil, nil, "token") test.That(t, ac.whoAmIAction(cCtx), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) diff --git a/cli/client.go b/cli/client.go index d5e24a7e1f4..aae57c46267 100644 --- a/cli/client.go +++ b/cli/client.go @@ -75,7 +75,6 @@ type viamClient struct { dataClient datapb.DataServiceClient packageClient packagepb.PackageServiceClient datasetClient datasetpb.DatasetServiceClient - endUserClient apppb.EndUserServiceClient mlTrainingClient mltrainingpb.MLTrainingServiceClient buildClient buildpb.BuildServiceClient baseURL *url.URL diff --git a/cli/client_test.go b/cli/client_test.go index 2755d9ed263..11819882327 100644 --- a/cli/client_test.go +++ b/cli/client_test.go @@ -90,14 +90,9 @@ func newTestContext(t *testing.T, flags map[string]any) *cli.Context { // setup creates a new cli.Context and viamClient with fake auth and the passed // in AppServiceClient and DataServiceClient. It also returns testWriters that capture Stdout and // Stdin. -func setup( - asc apppb.AppServiceClient, - dataClient datapb.DataServiceClient, - buildClient buildpb.BuildServiceClient, - endUserClient apppb.EndUserServiceClient, - defaultFlags map[string]any, - authMethod string, - cliArgs ...string, +func setup(asc apppb.AppServiceClient, dataClient datapb.DataServiceClient, + buildClient buildpb.BuildServiceClient, defaultFlags map[string]any, + authMethod string, cliArgs ...string, ) (*cli.Context, *viamClient, *testWriter, *testWriter) { out := &testWriter{} errOut := &testWriter{} @@ -126,14 +121,13 @@ func setup( } ac := &viamClient{ - client: asc, - conf: conf, - c: cCtx, - dataClient: dataClient, - buildClient: buildClient, - endUserClient: endUserClient, - selectedOrg: &apppb.Organization{}, - selectedLoc: &apppb.Location{}, + client: asc, + conf: conf, + c: cCtx, + dataClient: dataClient, + buildClient: buildClient, + selectedOrg: &apppb.Organization{}, + selectedLoc: &apppb.Location{}, } return cCtx, ac, out, errOut } @@ -151,7 +145,7 @@ func setupWithRunningPart( ) (*cli.Context, *viamClient, *testWriter, *testWriter) { t.Helper() - cCtx, ac, out, errOut := setup(asc, dataClient, buildClient, nil, defaultFlags, authMethod, cliArgs...) + cCtx, ac, out, errOut := setup(asc, dataClient, buildClient, defaultFlags, authMethod, cliArgs...) // this config could later become a parameter r, err := robotimpl.New(cCtx.Context, &robotconfig.Config{ @@ -192,7 +186,7 @@ func TestListOrganizationsAction(t *testing.T) { asc := &inject.AppServiceClient{ ListOrganizationsFunc: listOrganizationsFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.listOrganizationsAction(cCtx), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -213,7 +207,7 @@ func TestSetSupportEmailAction(t *testing.T) { OrganizationSetSupportEmailFunc: setSupportEmailFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.organizationsSupportEmailSetAction(cCtx, "test-org", "test-email"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -230,7 +224,7 @@ func TestGetSupportEmailAction(t *testing.T) { OrganizationGetSupportEmailFunc: getSupportEmailFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.organizationsSupportEmailGetAction(cCtx, "test-org"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -249,7 +243,7 @@ func TestBillingServiceDisableAction(t *testing.T) { DisableBillingServiceFunc: disableBillingFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.organizationDisableBillingServiceAction(cCtx, "test-org"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) test.That(t, len(out.messages), test.ShouldEqual, 1) @@ -280,7 +274,7 @@ func TestGetBillingConfigAction(t *testing.T) { GetBillingServiceConfigFunc: getConfigEmailFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.getBillingConfig(cCtx, "test-org"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) test.That(t, len(out.messages), test.ShouldEqual, 12) @@ -309,7 +303,7 @@ func TestOrganizationSetLogoAction(t *testing.T) { OrganizationSetLogoFunc: organizationSetLogoFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") // Create a temporary file for testing fileName := "test-logo-*.png" tmpFile, err := os.CreateTemp("", fileName) @@ -320,7 +314,7 @@ func TestOrganizationSetLogoAction(t *testing.T) { test.That(t, len(out.messages), test.ShouldEqual, 1) test.That(t, out.messages[0], test.ShouldContainSubstring, "Successfully set the logo for organization") - cCtx, ac, out, errOut = setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut = setup(asc, nil, nil, nil, "token") logoFileName2 := "test-logo-2-*.PNG" tmpFile2, err := os.CreateTemp("", logoFileName2) @@ -344,7 +338,7 @@ func TestGetLogoAction(t *testing.T) { OrganizationGetLogoFunc: getLogoFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.organizationsLogoGetAction(cCtx, "test-org"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -363,7 +357,7 @@ func TestEnableAuthServiceAction(t *testing.T) { EnableAuthServiceFunc: enableAuthServiceFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.enableAuthServiceAction(cCtx, "test-org"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -382,7 +376,7 @@ func TestDisableAuthServiceAction(t *testing.T) { DisableAuthServiceFunc: disableAuthServiceFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.disableAuthServiceAction(cCtx, "test-org"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -405,7 +399,7 @@ func TestListOAuthAppsAction(t *testing.T) { ListOAuthAppsFunc: listOAuthAppFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.listOAuthAppsAction(cCtx, "test-org"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) test.That(t, len(out.messages), test.ShouldEqual, 1) @@ -423,7 +417,7 @@ func TestDeleteOAuthAppAction(t *testing.T) { DeleteOAuthAppFunc: deleteOAuthAppFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.deleteOAuthAppAction(cCtx, "test-org", "client-id"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) test.That(t, len(out.messages), test.ShouldEqual, 1) @@ -440,7 +434,7 @@ func TestUpdateBillingServiceAction(t *testing.T) { UpdateBillingServiceFunc: updateConfigFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") address := "123 Main St, Suite 100, San Francisco, CA, 94105" test.That(t, ac.updateBillingServiceAction(cCtx, "test-org", address), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -466,7 +460,7 @@ func TestOrganizationEnableBillingServiceAction(t *testing.T) { EnableBillingServiceFunc: enableBillingFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.organizationEnableBillingServiceAction(cCtx, "test-org", "123 Main St, Suite 100, San Francisco, CA, 94105"), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -523,7 +517,7 @@ func TestDataExportTabularAction(t *testing.T) { ExportTabularDataFunc: exportTabularDataFunc, } - cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, dsc, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, dsc, nil, nil, "token") test.That(t, ac.dataExportTabularAction(cCtx, parseStructFromCtx[dataExportTabularArgs](cCtx)), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) @@ -577,7 +571,7 @@ func TestDataExportTabularAction(t *testing.T) { ExportTabularDataFunc: exportTabularDataFunc, } - cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, dsc, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(&inject.AppServiceClient{}, dsc, nil, nil, "token") err := ac.dataExportTabularAction(cCtx, parseStructFromCtx[dataExportTabularArgs](cCtx)) test.That(t, err, test.ShouldBeError, errors.New("error receiving tabular data: whoops")) @@ -747,7 +741,7 @@ func TestGetRobotPartLogs(t *testing.T) { } t.Run("no count", func(t *testing.T) { - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "") test.That(t, ac.robotsPartLogsAction(cCtx, parseStructFromCtx[robotsPartLogsArgs](cCtx)), test.ShouldBeNil) @@ -768,7 +762,7 @@ func TestGetRobotPartLogs(t *testing.T) { }) t.Run("178 count", func(t *testing.T) { flags := map[string]any{"count": 178} - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, flags, "") + cCtx, ac, out, errOut := setup(asc, nil, nil, flags, "") test.That(t, ac.robotsPartLogsAction(cCtx, parseStructFromCtx[robotsPartLogsArgs](cCtx)), test.ShouldBeNil) @@ -789,7 +783,7 @@ func TestGetRobotPartLogs(t *testing.T) { }) t.Run("max count", func(t *testing.T) { flags := map[string]any{generalFlagCount: maxNumLogs} - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, flags, "") + cCtx, ac, out, errOut := setup(asc, nil, nil, flags, "") test.That(t, ac.robotsPartLogsAction(cCtx, parseStructFromCtx[robotsPartLogsArgs](cCtx)), test.ShouldBeNil) @@ -811,7 +805,7 @@ func TestGetRobotPartLogs(t *testing.T) { }) t.Run("negative count", func(t *testing.T) { flags := map[string]any{"count": -1} - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, flags, "") + cCtx, ac, out, errOut := setup(asc, nil, nil, flags, "") test.That(t, ac.robotsPartLogsAction(cCtx, parseStructFromCtx[robotsPartLogsArgs](cCtx)), test.ShouldBeNil) @@ -834,7 +828,7 @@ func TestGetRobotPartLogs(t *testing.T) { }) t.Run("count too high", func(t *testing.T) { flags := map[string]any{"count": 1000000} - cCtx, ac, _, _ := setup(asc, nil, nil, nil, flags, "") + cCtx, ac, _, _ := setup(asc, nil, nil, flags, "") err := ac.robotsPartLogsAction(cCtx, parseStructFromCtx[robotsPartLogsArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) @@ -887,7 +881,7 @@ func TestShellFileCopy(t *testing.T) { } t.Run("no arguments or files", func(t *testing.T) { - cCtx, viamClient, _, _ := setup(asc, nil, nil, nil, partFlags, "token") + cCtx, viamClient, _, _ := setup(asc, nil, nil, partFlags, "token") test.That(t, viamClient.machinesPartCopyFilesAction(cCtx, parseStructFromCtx[machinesPartCopyFilesArgs](cCtx), logger), test.ShouldEqual, errNoFiles) @@ -895,13 +889,13 @@ func TestShellFileCopy(t *testing.T) { t.Run("one file path is insufficient", func(t *testing.T) { args := []string{"machine:path"} - cCtx, viamClient, _, _ := setup(asc, nil, nil, nil, partFlags, "token", args...) + cCtx, viamClient, _, _ := setup(asc, nil, nil, partFlags, "token", args...) test.That(t, viamClient.machinesPartCopyFilesAction(cCtx, parseStructFromCtx[machinesPartCopyFilesArgs](cCtx), logger), test.ShouldEqual, errLastArgOfFromMissing) args = []string{"path"} - cCtx, viamClient, _, _ = setup(asc, nil, nil, nil, partFlags, "token", args...) + cCtx, viamClient, _, _ = setup(asc, nil, nil, partFlags, "token", args...) test.That(t, viamClient.machinesPartCopyFilesAction(cCtx, parseStructFromCtx[machinesPartCopyFilesArgs](cCtx), logger), test.ShouldEqual, errLastArgOfToMissing) @@ -909,7 +903,7 @@ func TestShellFileCopy(t *testing.T) { t.Run("from has wrong path prefixes", func(t *testing.T) { args := []string{"machine:path", "path2", "machine:path3", "destination"} - cCtx, viamClient, _, _ := setup(asc, nil, nil, nil, partFlags, "token", args...) + cCtx, viamClient, _, _ := setup(asc, nil, nil, partFlags, "token", args...) test.That(t, viamClient.machinesPartCopyFilesAction(cCtx, parseStructFromCtx[machinesPartCopyFilesArgs](cCtx), logger), test.ShouldHaveSameTypeAs, copyFromPathInvalidError{}) @@ -1197,7 +1191,7 @@ func TestCreateOAuthAppAction(t *testing.T) { flags[oauthAppFlagRedirectURIs] = []string{"https://woof.com/home", "https://arf.com/home"} flags[oauthAppFlagLogoutURI] = "https://woof.com/logout" flags[oauthAppFlagEnabledGrants] = []string{"implicit", "password"} - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, flags, "token") test.That(t, ac.createOAuthAppAction(cCtx, parseStructFromCtx[createOAuthAppArgs](cCtx)), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) test.That(t, out.messages[0], test.ShouldContainSubstring, @@ -1206,7 +1200,7 @@ func TestCreateOAuthAppAction(t *testing.T) { t.Run("should error if pkce is not a valid enum value", func(t *testing.T) { flags := map[string]any{oauthAppFlagClientAuthentication: unspecified, oauthAppFlagPKCE: "not_one_of_the_allowed_values"} - cCtx, ac, out, _ := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, _ := setup(asc, nil, nil, flags, "token") err := ac.updateOAuthAppAction(cCtx, parseStructFromCtx[updateOAuthAppArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) test.That(t, err.Error(), test.ShouldContainSubstring, "pkce must be a valid PKCE") @@ -1218,7 +1212,7 @@ func TestCreateOAuthAppAction(t *testing.T) { oauthAppFlagClientAuthentication: unspecified, oauthAppFlagPKCE: unspecified, oauthAppFlagURLValidation: "not_one_of_the_allowed_values", } - cCtx, ac, out, _ := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, _ := setup(asc, nil, nil, flags, "token") err := ac.updateOAuthAppAction(cCtx, parseStructFromCtx[updateOAuthAppArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) test.That(t, err.Error(), test.ShouldContainSubstring, "url-validation must be a valid UrlValidation") @@ -1249,7 +1243,7 @@ func TestReadOAuthApp(t *testing.T) { ReadOAuthAppFunc: readOAuthAppFunc, } - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, nil, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, nil, "token") test.That(t, ac.readOAuthAppAction(cCtx, "test-org-id", "test-client-id"), test.ShouldBeNil) test.That(t, len(out.messages), test.ShouldEqual, 9) @@ -1286,7 +1280,7 @@ func TestUpdateOAuthAppAction(t *testing.T) { flags[oauthAppFlagRedirectURIs] = []string{"https://woof.com/home", "https://arf.com/home"} flags[oauthAppFlagLogoutURI] = "https://woof.com/logout" flags[oauthAppFlagEnabledGrants] = []string{"implicit", "password"} - cCtx, ac, out, errOut := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, errOut := setup(asc, nil, nil, flags, "token") test.That(t, ac.updateOAuthAppAction(cCtx, parseStructFromCtx[updateOAuthAppArgs](cCtx)), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) test.That(t, out.messages[0], test.ShouldContainSubstring, "Successfully updated OAuth app") @@ -1297,7 +1291,7 @@ func TestUpdateOAuthAppAction(t *testing.T) { flags[generalFlagOrgID] = "org-id" flags[oauthAppFlagClientID] = "client-id" flags[oauthAppFlagClientAuthentication] = "not_one_of_the_allowed_values" - cCtx, ac, out, _ := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, _ := setup(asc, nil, nil, flags, "token") err := ac.updateOAuthAppAction(cCtx, parseStructFromCtx[updateOAuthAppArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) test.That(t, err.Error(), test.ShouldContainSubstring, "client-authentication must be a valid ClientAuthentication") @@ -1306,7 +1300,7 @@ func TestUpdateOAuthAppAction(t *testing.T) { t.Run("should error if pkce is not a valid enum value", func(t *testing.T) { flags := map[string]any{oauthAppFlagClientAuthentication: unspecified, oauthAppFlagPKCE: "not_one_of_the_allowed_values"} - cCtx, ac, out, _ := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, _ := setup(asc, nil, nil, flags, "token") err := ac.updateOAuthAppAction(cCtx, parseStructFromCtx[updateOAuthAppArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) test.That(t, err.Error(), test.ShouldContainSubstring, "pkce must be a valid PKCE") @@ -1318,7 +1312,7 @@ func TestUpdateOAuthAppAction(t *testing.T) { oauthAppFlagClientAuthentication: unspecified, oauthAppFlagPKCE: unspecified, oauthAppFlagURLValidation: "not_one_of_the_allowed_values", } - cCtx, ac, out, _ := setup(asc, nil, nil, nil, flags, "token") + cCtx, ac, out, _ := setup(asc, nil, nil, flags, "token") err := ac.updateOAuthAppAction(cCtx, parseStructFromCtx[updateOAuthAppArgs](cCtx)) test.That(t, err, test.ShouldNotBeNil) test.That(t, err.Error(), test.ShouldContainSubstring, "url-validation must be a valid UrlValidation") diff --git a/cli/module_build_test.go b/cli/module_build_test.go index a7eeb58d7c0..71f2df17da6 100644 --- a/cli/module_build_test.go +++ b/cli/module_build_test.go @@ -56,7 +56,7 @@ func TestStartBuild(t *testing.T) { StartBuildFunc: func(ctx context.Context, in *v1.StartBuildRequest, opts ...grpc.CallOption) (*v1.StartBuildResponse, error) { return &v1.StartBuildResponse{BuildId: "xyz123"}, nil }, - }, nil, map[string]any{moduleFlagPath: manifest, generalFlagVersion: "1.2.3"}, "token") + }, map[string]any{moduleFlagPath: manifest, generalFlagVersion: "1.2.3"}, "token") err := ac.moduleBuildStartAction(cCtx, parseStructFromCtx[moduleBuildStartArgs](cCtx)) test.That(t, err, test.ShouldBeNil) test.That(t, out.messages, test.ShouldHaveLength, 1) @@ -79,7 +79,7 @@ func TestListBuild(t *testing.T) { }, }}, nil }, - }, nil, map[string]any{moduleFlagPath: manifest}, "token") + }, map[string]any{moduleFlagPath: manifest}, "token") err := ac.moduleBuildListAction(cCtx, parseStructFromCtx[moduleBuildListArgs](cCtx)) test.That(t, err, test.ShouldBeNil) joinedOutput := strings.Join(out.messages, "") @@ -121,7 +121,7 @@ func TestModuleBuildWait(t *testing.T) { }, }}, nil }, - }, nil, map[string]any{}, "token") + }, map[string]any{}, "token") startWaitTime := time.Now() statuses, err := ac.waitForBuildToFinish("xyz123", "") test.That(t, err, test.ShouldBeNil) @@ -154,7 +154,7 @@ func TestModuleGetPlatformsForModule(t *testing.T) { }, }}, nil }, - }, nil, map[string]any{}, "token") + }, map[string]any{}, "token") platforms, err := ac.getPlatformsForModuleBuild("xyz123") test.That(t, err, test.ShouldBeNil) test.That(t, platforms, test.ShouldResemble, []string{"linux/amd64", "linux/arm64"}) @@ -195,7 +195,7 @@ func TestLocalBuild(t *testing.T) { // run the build local action cCtx, _, out, errOut := setup(&inject.AppServiceClient{}, nil, &inject.BuildServiceClient{}, - nil, map[string]any{moduleFlagPath: manifestPath, generalFlagVersion: "1.2.3"}, "token") + map[string]any{moduleFlagPath: manifestPath, generalFlagVersion: "1.2.3"}, "token") manifest, err := loadManifest(manifestPath) test.That(t, err, test.ShouldBeNil) err = moduleBuildLocalAction(cCtx, &manifest) diff --git a/cli/module_generate_test.go b/cli/module_generate_test.go index d7e9cae4e56..6b77fe3d99b 100644 --- a/cli/module_generate_test.go +++ b/cli/module_generate_test.go @@ -159,7 +159,7 @@ func TestGenerateModuleAction(t *testing.T) { StartBuildFunc: func(ctx context.Context, in *v1.StartBuildRequest, opts ...grpc.CallOption) (*v1.StartBuildResponse, error) { return &v1.StartBuildResponse{BuildId: "xyz123"}, nil }, - }, nil, map[string]any{}, "token") + }, map[string]any{}, "token") err := createModuleAndManifest(cCtx, ac, testModule, globalArgs) test.That(t, err, test.ShouldBeNil) }) diff --git a/cli/module_registry_test.go b/cli/module_registry_test.go index ada46dd8703..27528d2b950 100644 --- a/cli/module_registry_test.go +++ b/cli/module_registry_test.go @@ -34,7 +34,7 @@ func TestUpdateModelsAction(t *testing.T) { test.That(t, err, test.ShouldBeNil) flags := map[string]any{"binary": binaryPath, "module": metaPath} - cCtx, _, _, errOut := setup(&inject.AppServiceClient{}, nil, nil, nil, flags, "") + cCtx, _, _, errOut := setup(&inject.AppServiceClient{}, nil, nil, flags, "") test.That(t, UpdateModelsAction(cCtx, parseStructFromCtx[updateModelsArgs](cCtx)), test.ShouldBeNil) test.That(t, len(errOut.messages), test.ShouldEqual, 0) diff --git a/cli/module_reload_test.go b/cli/module_reload_test.go index 9a29f1b70ff..7ef60ecd2e6 100644 --- a/cli/module_reload_test.go +++ b/cli/module_reload_test.go @@ -23,7 +23,7 @@ func TestConfigureModule(t *testing.T) { StartBuildFunc: func(ctx context.Context, in *v1.StartBuildRequest, opts ...grpc.CallOption) (*v1.StartBuildResponse, error) { return &v1.StartBuildResponse{BuildId: "xyz123"}, nil }, - }, nil, map[string]any{moduleFlagPath: manifestPath, generalFlagVersion: "1.2.3"}, "token") + }, map[string]any{moduleFlagPath: manifestPath, generalFlagVersion: "1.2.3"}, "token") err := ac.moduleBuildStartAction(cCtx, parseStructFromCtx[moduleBuildStartArgs](cCtx)) test.That(t, err, test.ShouldBeNil) test.That(t, out.messages, test.ShouldHaveLength, 1) @@ -62,7 +62,7 @@ func TestFullReloadFlow(t *testing.T) { {ApiKey: &apppb.APIKey{}}, }}, nil }, - }, nil, &inject.BuildServiceClient{}, nil, + }, nil, &inject.BuildServiceClient{}, map[string]any{ moduleFlagPath: manifestPath, generalFlagPartID: "part-123", moduleBuildFlagNoBuild: true, moduleFlagLocal: true, diff --git a/testutils/inject/enduser_service_client.go b/testutils/inject/enduser_service_client.go deleted file mode 100644 index 3f4679f0615..00000000000 --- a/testutils/inject/enduser_service_client.go +++ /dev/null @@ -1,52 +0,0 @@ -package inject - -import ( - "context" - - apppb "go.viam.com/api/app/v1" - "google.golang.org/grpc" -) - -// EndUserServiceClient represents a fake instance of an end user service client. -type EndUserServiceClient struct { - apppb.EndUserServiceClient - RegisterAuthApplicationFunc func(ctx context.Context, in *apppb.RegisterAuthApplicationRequest, - opts ...grpc.CallOption, - ) (*apppb.RegisterAuthApplicationResponse, error) - UpdateAuthApplicationFunc func(ctx context.Context, in *apppb.UpdateAuthApplicationRequest, - opts ...grpc.CallOption, - ) (*apppb.UpdateAuthApplicationResponse, error) - GetAuthApplicationFunc func(ctx context.Context, in *apppb.GetAuthApplicationRequest, - opts ...grpc.CallOption, - ) (*apppb.GetAuthApplicationResponse, error) -} - -// RegisterAuthApplication calls the injected RegisterAuthApplicationFunc or the real version. -func (eusc *EndUserServiceClient) RegisterAuthApplication(ctx context.Context, in *apppb.RegisterAuthApplicationRequest, - opts ...grpc.CallOption, -) (*apppb.RegisterAuthApplicationResponse, error) { - if eusc.RegisterAuthApplicationFunc == nil { - return eusc.EndUserServiceClient.RegisterAuthApplication(ctx, in, opts...) - } - return eusc.RegisterAuthApplicationFunc(ctx, in, opts...) -} - -// UpdateAuthApplication calls the injected UpdateAuthApplicationFunc or the real version. -func (eusc *EndUserServiceClient) UpdateAuthApplication(ctx context.Context, in *apppb.UpdateAuthApplicationRequest, - opts ...grpc.CallOption, -) (*apppb.UpdateAuthApplicationResponse, error) { - if eusc.UpdateAuthApplicationFunc == nil { - return eusc.EndUserServiceClient.UpdateAuthApplication(ctx, in, opts...) - } - return eusc.UpdateAuthApplicationFunc(ctx, in, opts...) -} - -// GetAuthApplication calls the injected GetAuthApplication or the real version. -func (eusc *EndUserServiceClient) GetAuthApplication(ctx context.Context, in *apppb.GetAuthApplicationRequest, - opts ...grpc.CallOption, -) (*apppb.GetAuthApplicationResponse, error) { - if eusc.GetAuthApplicationFunc == nil { - return eusc.EndUserServiceClient.GetAuthApplication(ctx, in, opts...) - } - return eusc.GetAuthApplicationFunc(ctx, in, opts...) -}