fix test credentials with empty username - KeePass

This commit is contained in:
Vladimir Krivosheev
2016-11-04 17:15:22 +01:00
parent ced3e2d03c
commit b8a41dcd85
3 changed files with 3 additions and 4 deletions
@@ -64,7 +64,7 @@ class PasswordSafeImpl @JvmOverloads constructor(val settings: PasswordSafeSetti
override fun set(attributes: CredentialAttributes, credentials: Credentials?) {
currentProvider.set(attributes, credentials)
if (attributes.isPasswordMemoryOnly && credentials.isFulfilled()) {
if (attributes.isPasswordMemoryOnly && !credentials?.password.isNullOrEmpty()) {
// we must store because otherwise on get will be no password
memoryHelperProvider.value.set(attributes.toPasswordStoreable(), credentials)
}
@@ -19,5 +19,5 @@ import org.junit.runner.RunWith
import org.junit.runners.Suite
@RunWith(Suite::class)
@Suite.SuiteClasses(FileCredentialStoreTest::class, CredentialSerializeTest::class, CredentialStoreTest::class, MasterPasswordMigrationTest::class)
@Suite.SuiteClasses(FileCredentialStoreTest::class, CredentialSerializeTest::class, CredentialStoreTest::class, PasswordSafeTest::class, MasterPasswordMigrationTest::class)
internal class CredentialStoreTestSuite
@@ -150,8 +150,7 @@ class PasswordSafeTest {
val ps = PasswordSafeImpl(settings, KeePassCredentialStore(baseDirectory = tempDirManager.newPath()))
val id = "test PasswordSafeTest.credentials with empty username"
val attributes = CredentialAttributes(id, null, null, true)
val attributes = CredentialAttributes(id, isPasswordMemoryOnly = true)
try {
val credentials = Credentials(null, "passphrase")
ps.set(attributes, credentials)