Skip to content

Commit 31e120b

Browse files
authored
Adding a status to ACL users (#132)
1 parent 7ec7c73 commit 31e120b

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

role_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ func TestListRoles(t *testing.T) {
679679
},
680680
},
681681
Users: []*roles.GetUserInRoleResponse{},
682-
Status: redis.String("active"),
682+
Status: redis.String(roles.StatusActive),
683683
},
684684
{
685685
ID: redis.Int(999),
@@ -711,7 +711,7 @@ func TestListRoles(t *testing.T) {
711711
Name: redis.String("test-user"),
712712
},
713713
},
714-
Status: redis.String("active"),
714+
Status: redis.String(roles.StatusActive),
715715
},
716716
}, actual)
717717

@@ -905,7 +905,7 @@ func TestGetRole(t *testing.T) {
905905
Name: redis.String("test-user"),
906906
},
907907
},
908-
Status: redis.String("active"),
908+
Status: redis.String(roles.StatusActive),
909909
}, actual)
910910

911911
}

service/access_control_lists/users/model.go

+15-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ func (o ListUsersResponse) String() string {
1414
}
1515

1616
type GetUserResponse struct {
17-
ID *int `json:"id,omitempty"`
18-
Name *string `json:"name,omitempty"`
19-
Role *string `json:"role,omitempty"`
17+
ID *int `json:"id,omitempty"`
18+
Name *string `json:"name,omitempty"`
19+
Role *string `json:"role,omitempty"`
20+
Status *string `json:"status,omitempty"`
2021
}
2122

2223
func (o GetUserResponse) String() string {
@@ -45,3 +46,14 @@ type UpdateUserRequest struct {
4546
func (o UpdateUserRequest) String() string {
4647
return internal.ToString(o)
4748
}
49+
50+
const (
51+
// StatusActive is the active value of the `Status` field in `User`
52+
StatusActive = "active"
53+
// StatusPending is the pending value of the `Status` field in `User`
54+
StatusPending = "pending"
55+
// StatusError is the error value of the `Status` field in `User`
56+
StatusError = "error"
57+
// StatusDeleting is the deleting value of the `Status` field in `User`
58+
StatusDeleting = "deleting"
59+
)

user_test.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ func TestGetUser(t *testing.T) {
526526
"id": 20000,
527527
"name": "test-user",
528528
"role": "test-role",
529+
"status": "pending",
529530
"links": [
530531
{
531532
"rel": "self",
@@ -544,8 +545,9 @@ func TestGetUser(t *testing.T) {
544545
require.NoError(t, err)
545546

546547
assert.Equal(t, &users.GetUserResponse{
547-
ID: redis.Int(20000),
548-
Name: redis.String("test-user"),
549-
Role: redis.String("test-role"),
548+
ID: redis.Int(20000),
549+
Name: redis.String("test-user"),
550+
Role: redis.String("test-role"),
551+
Status: redis.String(users.StatusPending),
550552
}, actual)
551553
}

0 commit comments

Comments
 (0)