- Create command under /authme debug that allows to change the 'nullable' status of MySQL columns (currently last date and email only) - We need to offer a default value for forum integrations that have a NOT NULL email column. Offering a command avoids us from force-migrating existing databases while still offering migrations in both directions - Change in default value handling: lack of values are not handled by setting default values to the PlayerAuth anymore, and reading a default value from the database into a PlayerAuth will be translated into null by the PlayerAuth builder - When a new database is created, email and lastlogin are now nullable and lack a default a value Open points: - Finish MySqlDefaultChangerTest - Revise purging logic (#792) - Allow to have more columns nullable (#814)
This commit is contained in:
@@ -162,20 +162,36 @@ public class AuthMeApiTest {
|
||||
public void shouldGetLastLogin() {
|
||||
// given
|
||||
String name = "David";
|
||||
Player player = mockPlayerWithName(name);
|
||||
PlayerAuth auth = PlayerAuth.builder().name(name)
|
||||
.lastLogin(1501597979)
|
||||
.lastLogin(1501597979L)
|
||||
.build();
|
||||
given(playerCache.getAuth(name)).willReturn(auth);
|
||||
|
||||
// when
|
||||
Date result = api.getLastLogin(player.getName());
|
||||
Date result = api.getLastLogin(name);
|
||||
|
||||
// then
|
||||
assertThat(result, not(nullValue()));
|
||||
assertThat(result, equalTo(new Date(1501597979)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHandleNullLastLogin() {
|
||||
// given
|
||||
String name = "John";
|
||||
PlayerAuth auth = PlayerAuth.builder().name(name)
|
||||
.lastLogin(null)
|
||||
.build();
|
||||
given(dataSource.getAuth(name)).willReturn(auth);
|
||||
|
||||
// when
|
||||
Date result = api.getLastLogin(name);
|
||||
|
||||
// then
|
||||
assertThat(result, nullValue());
|
||||
verify(dataSource).getAuth(name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnNullForUnavailablePlayer() {
|
||||
// given
|
||||
|
||||
Reference in New Issue
Block a user