use of fr.xephi.authme.data.auth.PlayerAuth in project AuthMeReloaded by AuthMe.
the class OnJoinVerifierTest method shouldAcceptCasingMismatchForDisabledSetting.
@Test
public void shouldAcceptCasingMismatchForDisabledSetting() throws FailedVerificationException {
// given
Player player = newPlayerWithName("Test");
PlayerAuth auth = PlayerAuth.builder().name("test").realName("TEST").build();
given(settings.getProperty(RegistrationSettings.PREVENT_OTHER_CASE)).willReturn(false);
// when
onJoinVerifier.checkNameCasing(player, auth);
// then
verifyZeroInteractions(dataSource);
}
use of fr.xephi.authme.data.auth.PlayerAuth in project AuthMeReloaded by AuthMe.
the class OnJoinVerifierTest method shouldUpdateDefaultRealName.
@Test
public void shouldUpdateDefaultRealName() throws FailedVerificationException {
// given
Player player = newPlayerWithName("SOMEONE");
PlayerAuth auth = PlayerAuth.builder().name("someone").realName("Player").build();
given(settings.getProperty(RegistrationSettings.PREVENT_OTHER_CASE)).willReturn(true);
// when
onJoinVerifier.checkNameCasing(player, auth);
// then
verify(dataSource).updateRealName("someone", "SOMEONE");
}
use of fr.xephi.authme.data.auth.PlayerAuth in project AuthMeReloaded by AuthMe.
the class AbstractDataSourceIntegrationTest method shouldUpdateLastLoc.
@Test
public void shouldUpdateLastLoc() {
// given
DataSource dataSource = getDataSource();
PlayerAuth user = PlayerAuth.builder().name("user").locX(143).locY(-42.12).locZ(29.47).locWorld("the_end").locYaw(2.2f).locPitch(0.45f).build();
// when
boolean response = dataSource.updateQuitLoc(user);
// then
assertThat(response, equalTo(true));
assertThat(dataSource.getAuth("user"), hasAuthLocation(user));
}
use of fr.xephi.authme.data.auth.PlayerAuth in project AuthMeReloaded by AuthMe.
the class AbstractDataSourceIntegrationTest method shouldGetRecordsToPurge.
@Test
public void shouldGetRecordsToPurge() {
// given
DataSource dataSource = getDataSource();
PlayerAuth auth = PlayerAuth.builder().name("potato").lastLogin(0).build();
dataSource.saveAuth(auth);
// 1453242857 -> user, 1449136800 -> bobby, 0 -> potato
// when
Set<String> records1 = dataSource.getRecordsToPurge(1450000000, true);
Set<String> records2 = dataSource.getRecordsToPurge(1460000000, false);
// then
assertThat(records1, containsInAnyOrder("bobby", "potato"));
assertThat(records2, containsInAnyOrder("bobby", "user"));
// check that the entry was not deleted because of running this command
assertThat(dataSource.isAuthAvailable("bobby"), equalTo(true));
}
use of fr.xephi.authme.data.auth.PlayerAuth in project AuthMeReloaded by AuthMe.
the class AbstractDataSourceIntegrationTest method shouldUpdatePasswordWithPlayerAuth.
@Test
public void shouldUpdatePasswordWithPlayerAuth() {
// given
DataSource dataSource = getDataSource("salt");
PlayerAuth bobbyAuth = PlayerAuth.builder().name("bobby").password(new HashedPassword("tt", "cc")).build();
PlayerAuth invalidAuth = PlayerAuth.builder().name("invalid").password(new HashedPassword("tt", "cc")).build();
// when
boolean response1 = dataSource.updatePassword(bobbyAuth);
boolean response2 = dataSource.updatePassword(invalidAuth);
// then
assertThat(response1 && response2, equalTo(true));
assertThat(dataSource.getPassword("bobby"), equalToHash("tt", "cc"));
}
Aggregations