internal/directory: use both id and name for group (#1086)

Fixes #1085
This commit is contained in:
Cuong Manh Le 2020-07-17 00:15:11 +07:00 committed by GitHub
parent 96424dac0f
commit ee1f9093ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 59 additions and 49 deletions

View file

@ -32,8 +32,8 @@ func newMockAPI(t *testing.T, srv *httptest.Server) http.Handler {
})
r.Get("/groups", func(w http.ResponseWriter, r *http.Request) {
_ = json.NewEncoder(w).Encode([]M{
{"id": 1},
{"id": 2},
{"id": 1, "name": "Group 1"},
{"id": 2, "name": "Group 2"},
})
})
r.Get("/groups/{group_name}/members", func(w http.ResponseWriter, r *http.Request) {
@ -69,9 +69,9 @@ func Test(t *testing.T) {
users, err := p.UserGroups(context.Background())
assert.NoError(t, err)
testutil.AssertProtoJSONEqual(t, `[
{ "id": "gitlab/11", "groups": ["1"] },
{ "id": "gitlab/12", "groups": ["2"] },
{ "id": "gitlab/13", "groups": ["2"] }
{ "id": "gitlab/11", "groups": ["1", "Group 1"] },
{ "id": "gitlab/12", "groups": ["2", "Group 2"] },
{ "id": "gitlab/13", "groups": ["2", "Group 2"] }
]`, users)
}