Addendum to login/auth improvements to make sure communication info gets parsed

Only update db fields if they have changed
This commit is contained in:
Ceikry
2022-05-18 13:59:51 +00:00
committed by Ryan
parent 7faa0a2c7c
commit 907838bb5f
7 changed files with 177 additions and 164 deletions
@@ -178,4 +178,24 @@ class SQLStorageProviderTests {
val info3 = storage.getAccountInfo("dbupdateacc")
Assertions.assertEquals(2, info3.rights)
}
@Test fun shouldCorrectlyUpdateMultipleChangedValues() {
val userData = UserAccountInfo.createDefault()
userData.username = "borpis2"
userData.password = "test"
testAccountNames.add("borpis2")
storage.store(userData)
val lastLogin = System.currentTimeMillis()
userData.credits = 2
userData.lastLogin = lastLogin
userData.currentClan = "3009scape"
storage.update(userData)
val data = storage.getAccountInfo(userData.username)
Assertions.assertEquals(2, data.credits, "Wrong data: $data")
Assertions.assertEquals(lastLogin, data.lastLogin, "Wrong data: $data")
Assertions.assertEquals("3009scape", data.currentClan, "Wrong data: $data")
}
}