-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify group managers to skip fetching members when specified
- Loading branch information
Showing
11 changed files
with
112 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Enhancement: Modify group and user managers to skip fetching specified metadata | ||
|
||
https://github.com/cs3org/reva/pull/2205 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,30 +102,43 @@ func TestUserManager(t *testing.T) { | |
DisplayName: "Sailing Lovers", | ||
Members: members, | ||
} | ||
groupWithoutMembers := &grouppb.Group{ | ||
Id: gid, | ||
GroupName: "sailing-lovers", | ||
Mail: "[email protected]", | ||
GidNumber: 1234, | ||
DisplayName: "Sailing Lovers", | ||
} | ||
groupFake := &grouppb.GroupId{OpaqueId: "fake-group"} | ||
|
||
// positive test GetGroup | ||
resGroup, _ := manager.GetGroup(ctx, gid) | ||
resGroup, _ := manager.GetGroup(ctx, gid, false) | ||
if !reflect.DeepEqual(resGroup, group) { | ||
t.Fatalf("group differs: expected=%v got=%v", group, resGroup) | ||
} | ||
|
||
// positive test GetGroup without members | ||
resGroupWithoutMembers, _ := manager.GetGroup(ctx, gid, true) | ||
if !reflect.DeepEqual(resGroupWithoutMembers, groupWithoutMembers) { | ||
t.Fatalf("group differs: expected=%v got=%v", groupWithoutMembers, resGroupWithoutMembers) | ||
} | ||
|
||
// negative test GetGroup | ||
expectedErr := errtypes.NotFound(groupFake.OpaqueId) | ||
_, err = manager.GetGroup(ctx, groupFake) | ||
_, err = manager.GetGroup(ctx, groupFake, false) | ||
if !reflect.DeepEqual(err, expectedErr) { | ||
t.Fatalf("group not found error differ: expected='%v' got='%v'", expectedErr, err) | ||
} | ||
|
||
// positive test GetGroupByClaim by mail | ||
resGroupByEmail, _ := manager.GetGroupByClaim(ctx, "mail", "[email protected]") | ||
resGroupByEmail, _ := manager.GetGroupByClaim(ctx, "mail", "[email protected]", false) | ||
if !reflect.DeepEqual(resGroupByEmail, group) { | ||
t.Fatalf("group differs: expected=%v got=%v", group, resGroupByEmail) | ||
} | ||
|
||
// negative test GetGroupByClaim by mail | ||
expectedErr = errtypes.NotFound("[email protected]") | ||
_, err = manager.GetGroupByClaim(ctx, "mail", "[email protected]") | ||
_, err = manager.GetGroupByClaim(ctx, "mail", "[email protected]", false) | ||
if !reflect.DeepEqual(err, expectedErr) { | ||
t.Fatalf("group not found error differs: expected='%v' got='%v'", expectedErr, err) | ||
} | ||
|
@@ -149,7 +162,7 @@ func TestUserManager(t *testing.T) { | |
} | ||
|
||
// test FindGroups | ||
resFind, _ := manager.FindGroups(ctx, "sail") | ||
resFind, _ := manager.FindGroups(ctx, "sail", false) | ||
if len(resFind) != 1 { | ||
t.Fatalf("too many groups found: expected=%d got=%d", 1, len(resFind)) | ||
} | ||
|
Oops, something went wrong.