-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] CODENVY-627 Check for reserved usernames on user creation #1511
Conversation
Missing test to check ConflictException when calling create method with a reserved name |
@@ -68,6 +76,9 @@ public UserManager(UserDao userDao, | |||
* when any other error occurs | |||
*/ | |||
public void create(User user, boolean isTemporary) throws ConflictException, ServerException { | |||
if (isNameReserved(user.getName())) { | |||
throw new ConflictException("Username is reserved"); |
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.
Add name to exception message
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.
ok
@Test | ||
public void shouldCreateProfileAndPreferencesOnUserCreation() throws Exception { | ||
final User user = new User().withEmail("test@email.com").withName("testName"); | ||
manager.create(user, false); | ||
|
||
new UserManager(userDao, profileDao, preferenceDao, new String[0]).create(user, false); |
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.
mb it would be better to create instance of UserManager in method annotated with @BeforeMethod
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.
i think it's ok as is it. If there will be more tests, maybe then add BeforeMethod.
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.
mb it would be better to create instance of UserManager in method annotated with @BeforeMethod
+1
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.
ok
Build # 926 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/926/ to view the results. |
@@ -68,6 +74,9 @@ public UserManager(UserDao userDao, | |||
* when any other error occurs | |||
*/ | |||
public void create(User user, boolean isTemporary) throws ConflictException, ServerException { | |||
if (reservedNames.contains(user.getName())) { |
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.
I propose to do this case-insensitive
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.
ok
ок, wait for feature approval before merge |
Build # 940 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/940/ to view the results. |
ci-build |
Build # 949 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/949/ to view the results. |
merged as part of #1572 |
No description provided.