Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoaresd committed Jul 18, 2024
1 parent 0561380 commit 7d9fe84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/banneduser/banneduser.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func NewBannedUser(userSignup *toolchainv1alpha1.UserSignup, bannedBy string) (*
return bannedUser, nil
}

// IsAlreadyBanned checks if the user was already banned
func IsAlreadyBanned(ctx context.Context, userEmailHash string, hostClient client.Client, hostNamespace string) (*toolchainv1alpha1.BannedUser, error) {
// GetBannedUser returns BannedUser with the provided user email hash if found. Otherwise it returns nil.
func GetBannedUser(ctx context.Context, userEmailHash string, hostClient client.Client, hostNamespace string) (*toolchainv1alpha1.BannedUser, error) {
emailHashLabelMatch := client.MatchingLabels(map[string]string{
toolchainv1alpha1.BannedUserEmailHashLabelKey: userEmailHash,
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/banneduser/banneduser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestNewBannedUser(t *testing.T) {
}
}

func TestIsAlreadyBanned(t *testing.T) {
func TestGetBannedUser(t *testing.T) {
userSignup1 := commonsignup.NewUserSignup(commonsignup.WithName("johny"), commonsignup.WithEmail("johny@example.com"))
userSignup2 := commonsignup.NewUserSignup(commonsignup.WithName("bob"), commonsignup.WithEmail("bob@example.com"))
userSignup3 := commonsignup.NewUserSignup(commonsignup.WithName("oliver"), commonsignup.WithEmail("oliver@example.com"))
Expand Down Expand Up @@ -158,7 +158,7 @@ func TestIsAlreadyBanned(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotResult, err := IsAlreadyBanned(ctx, tt.toBan.Labels[toolchainv1alpha1.BannedUserEmailHashLabelKey], tt.fakeClient, test.HostOperatorNs)
gotResult, err := GetBannedUser(ctx, tt.toBan.Labels[toolchainv1alpha1.BannedUserEmailHashLabelKey], tt.fakeClient, test.HostOperatorNs)

if tt.wantError {
require.Error(t, err)
Expand Down

0 comments on commit 7d9fe84

Please sign in to comment.