From b5299dbddb7880405f62c32b7be00bece0fb3aae Mon Sep 17 00:00:00 2001 From: Shaverdova Elena Date: Wed, 2 Nov 2016 16:22:11 +0100 Subject: [PATCH] Test for WI-33778 Save passphrase checkbox doesn't reflect the actual state --- .../credential-store/test/PasswordSafeTest.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/platform/credential-store/test/PasswordSafeTest.kt b/platform/credential-store/test/PasswordSafeTest.kt index 85d98d8e13ee..47e918b610e8 100644 --- a/platform/credential-store/test/PasswordSafeTest.kt +++ b/platform/credential-store/test/PasswordSafeTest.kt @@ -140,5 +140,25 @@ class PasswordSafeTest { assertThat.isEqualTo(newCredentials.password) } } + + @Test + fun `credentials with empty username`() { + if (UsefulTestCase.IS_UNDER_TEAMCITY) { + return + } + + val settings = PasswordSafeSettings() + settings.providerType = ProviderType.KEYCHAIN + val ps = PasswordSafeImpl(settings, KeyChainCredentialStore()) + + val id = "test PasswordSafeTest.credentials with empty username" + val attributes = CredentialAttributes(id, null, null, true) + + val credentials = Credentials(null, "passphrase") + ps.set(attributes, credentials) + val saved = ps.get(attributes)!! + assertThat(saved.password).isEqualTo(credentials.password) + assertThat(saved.userName).isNullOrEmpty() + } }