-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APP-7007: implement DisableAuthService CLI command #4686
Conversation
printf(c.App.Writer, yellow, fmt.Sprintf("You are trying to disable auth service for organization ID %s. "+ | ||
"Once disabled, this will remove and permanently delete all white-labeled login flows for any applications "+ | ||
"associated with your organization ID\n", args.OrgID)) | ||
printf(c.App.Writer, yellow, "If you wish to continue, please type \"disable\":") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Great
@@ -371,6 +371,25 @@ func TestEnableAuthServiceAction(t *testing.T) { | |||
test.That(t, out.messages[0], test.ShouldContainSubstring, "enabled auth") | |||
} | |||
|
|||
func TestDisableAuthServiceAction(t *testing.T) { | |||
disableAuthServiceFunc := func(ctx context.Context, in *apppb.DisableAuthServiceRequest, opts ...grpc.CallOption) ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way to validate
- the empty org ID
- the valid org ID followed by an abort
- the valid org ID followed by a DISABLE
? If not easy lmk - but would hope to assert that stuff in code in addition to our manual tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont know if there is an easy way to cases 2 and 3 here, @purplenicole730 do u know how i could test this? but i did add a test case for the empty org ID case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too sure, since I'm not too familiar with the Before capability (which I'm assuming is what DISABLE
is from). My best guess is to see how the other functions that have Before capabilities are tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can't figure it out after searching on the internet/our code, then at least include this test in the description so that we know you manually tested it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@purplenicole730 SGTM !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any existing tests for the Before action , but I added my manual testing in the description!
}, | ||
}, | ||
{ | ||
Name: "auth-service", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this deleting the existing "auth-service"? Ideally wouldn't remove here - we have a separate ticket in the epic for unwinding / removing the existing stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Otherwise, this becomes a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, this was a mistake i made when merging the enable auth service ticket earlier, i accidentally ended up having 2 "auth-service" subcommands (from this epic), so im fixing this and putting it in the right spot here. the existing "auth-service" stuff is still in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nits (sorry!) - one Q about testing coverage - and one Q about removal of auth-service
@maxhorowitz If you don't mind, can you add all these comments into one review so that it's easier to follow, and it doesn't spam others' emails 😅 ? |
Co-authored-by: Max Horowitz <[email protected]>
Co-authored-by: Max Horowitz <[email protected]>
}, | ||
}, | ||
{ | ||
Name: "auth-service", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Otherwise, this becomes a breaking change
cli/client.go
Outdated
"Once disabled, all custom auth views and emails will be removed from your organization's (%s) " + " | ||
"OAuth applications and permanently deleted.\n", args.OrgID)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image in the PR description doesn't seem to match this text. Please update. I'd like to see it since I'm not sure what the second %s
value is.
Co-authored-by: Max Horowitz <[email protected]>
Co-authored-by: Max Horowitz <[email protected]>
Co-authored-by: Max Horowitz <[email protected]>
cli/app.go
Outdated
{ | ||
Name: "disable", | ||
Usage: "disable auth-service for OAuth applications", | ||
UsageText: createUsageText("disable", []string{generalFlagOrgID}, true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized, why is otheroptions
marked as true? The only option is the required one, so this should be set to false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Action items before merge:
- Address Nicole's comment about
otheroptions
- Add comment describing manual test if not unit testable
Otherwise, great work!
cli/app.go
Outdated
{ | ||
Name: "disable", | ||
Usage: "disable auth-service for OAuth applications", | ||
UsageText: createUsageText("disable", []string{generalFlagOrgID}, true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch
Ticket:
Manual testing:
abort option
disable option (didn't have an org with auth service enabled yet, but the rpc response is expected)