#427 Replace registration settings with one registration type property

- Merge "useEmail" / "usePasswordConfirmation" / "useEmailConfirmation" settings into enum property
- Migrate old settings
This commit is contained in:
ljacqu
2016-12-15 22:36:54 +01:00
parent 811ceaf7ff
commit f9acb3cca1
15 changed files with 157 additions and 103 deletions
@@ -8,6 +8,7 @@ import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RegistrationArgumentType;
import org.bukkit.entity.Player;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -172,7 +173,7 @@ public class AsyncAddEmailTest {
given(player.getName()).willReturn("user");
given(playerCache.isAuthenticated("user")).willReturn(false);
given(dataSource.isAuthAvailable("user")).willReturn(false);
given(service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)).willReturn(true);
given(service.getProperty(RegistrationSettings.REGISTRATION_TYPE)).willReturn(RegistrationArgumentType.EMAIL);
// when
asyncAddEmail.addEmail(player, "test@mail.com");
@@ -188,7 +189,7 @@ public class AsyncAddEmailTest {
given(player.getName()).willReturn("user");
given(playerCache.isAuthenticated("user")).willReturn(false);
given(dataSource.isAuthAvailable("user")).willReturn(false);
given(service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)).willReturn(false);
given(service.getProperty(RegistrationSettings.REGISTRATION_TYPE)).willReturn(RegistrationArgumentType.PASSWORD_WITH_CONFIRMATION);
// when
asyncAddEmail.addEmail(player, "test@mail.com");
@@ -7,6 +7,7 @@ import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RegistrationArgumentType;
import org.bukkit.entity.Player;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -184,7 +185,7 @@ public class AsyncChangeEmailTest {
given(player.getName()).willReturn("Bobby");
given(playerCache.isAuthenticated("bobby")).willReturn(false);
given(dataSource.isAuthAvailable("Bobby")).willReturn(false);
given(service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)).willReturn(true);
given(service.getProperty(RegistrationSettings.REGISTRATION_TYPE)).willReturn(RegistrationArgumentType.EMAIL_WITH_CONFIRMATION);
// when
process.changeEmail(player, "old@mail.tld", "new@mail.tld");
@@ -201,7 +202,7 @@ public class AsyncChangeEmailTest {
given(player.getName()).willReturn("Bobby");
given(playerCache.isAuthenticated("bobby")).willReturn(false);
given(dataSource.isAuthAvailable("Bobby")).willReturn(false);
given(service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)).willReturn(false);
given(service.getProperty(RegistrationSettings.REGISTRATION_TYPE)).willReturn(RegistrationArgumentType.PASSWORD);
// when
process.changeEmail(player, "old@mail.tld", "new@mail.tld");