* #1119 new permission and email hider * Updated commands.md * Improved email hiding method * Revert "Improved email hiding method" This reverts commit cb60d7b * New config option, updated tests, config.md and permission_nodes.md * Moved to service import, fixed typo and updated config.md * Removed unused imports O.o
This commit is contained in:
@@ -4,6 +4,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -30,7 +31,7 @@ public class ShowEmailCommandTest {
|
||||
private ShowEmailCommand command;
|
||||
|
||||
@Mock
|
||||
private CommonService commandService;
|
||||
private CommonService commonService;
|
||||
|
||||
@Mock
|
||||
private PlayerCache playerCache;
|
||||
@@ -41,12 +42,28 @@ public class ShowEmailCommandTest {
|
||||
Player sender = mock(Player.class);
|
||||
given(sender.getName()).willReturn(USERNAME);
|
||||
given(playerCache.getAuth(USERNAME)).willReturn(newAuthWithEmail(CURRENT_EMAIL));
|
||||
given(commonService.getProperty(SecuritySettings.USE_EMAIL_MASKING)).willReturn(false);
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, Collections.emptyList());
|
||||
|
||||
// then
|
||||
verify(commandService).send(sender, MessageKey.EMAIL_SHOW, CURRENT_EMAIL);
|
||||
verify(commonService).send(sender, MessageKey.EMAIL_SHOW, CURRENT_EMAIL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldShowHiddenEmailMessage() {
|
||||
// given
|
||||
Player sender = mock(Player.class);
|
||||
given(sender.getName()).willReturn(USERNAME);
|
||||
given(playerCache.getAuth(USERNAME)).willReturn(newAuthWithEmail(CURRENT_EMAIL));
|
||||
given(commonService.getProperty(SecuritySettings.USE_EMAIL_MASKING)).willReturn(true);
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, Collections.emptyList());
|
||||
|
||||
// then
|
||||
verify(commonService).send(sender, MessageKey.EMAIL_SHOW, "my.***@***mple.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -60,7 +77,7 @@ public class ShowEmailCommandTest {
|
||||
command.executeCommand(sender, Collections.emptyList());
|
||||
|
||||
// then
|
||||
verify(commandService).send(sender, MessageKey.SHOW_NO_EMAIL);
|
||||
verify(commonService).send(sender, MessageKey.SHOW_NO_EMAIL);
|
||||
}
|
||||
|
||||
private static PlayerAuth newAuthWithEmail(String email) {
|
||||
|
||||
Reference in New Issue
Block a user