-
-
Notifications
You must be signed in to change notification settings - Fork 971
fix: fix flaky scaffolding Geb tests and User.getAuthorities() bug #15480
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
base: 7.0.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,14 @@ class User implements UserDetails { | |
|
|
||
| @Override | ||
| Collection<? extends GrantedAuthority> getAuthorities() { | ||
| roles.split('').collect { new SimpleGrantedAuthority(it) } | ||
| if (!roles) { | ||
| return Collections.emptyList() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just '[]' since this is groovy? |
||
| } | ||
| roles | ||
| .split(',') | ||
| .collect { it.trim() } | ||
| .findAll { it } | ||
| .collect { new SimpleGrantedAuthority(it) } | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ import grails.testing.mixin.integration.Integration | |
| @Integration | ||
| class UserCommunityControllerSpec extends ContainerGebSpec { | ||
|
|
||
| void setup() { | ||
| private void loginAsTestUser() { | ||
| to(LoginPage).login() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would the http session be different between setup and the one test? @matrei any idea?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jdaugherty No, I would think it should work to login in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamesfredley I don't think this PR is actually fixing this issue. |
||
| } | ||
|
|
||
|
|
@@ -42,9 +42,10 @@ class UserCommunityControllerSpec extends ContainerGebSpec { | |
|
|
||
| void "User list"() { | ||
| when: | ||
| loginAsTestUser() | ||
| def page = to(CommunityUserListPage) | ||
|
|
||
| then: | ||
| !page.scaffoldTable | ||
| } | ||
| } | ||
| } | ||
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.
Why not just '[]' since this is groovy?