Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ class ApplicationPasswordManagerTests {
verify(applicationPasswordsStore).saveCredentials(site, testCredentials)
}

@Test
fun `given a non-jetpack site with a null username, when we ask for a password, then return Failure`() =
runTest {
val site = SiteModel().apply {
url = "http://no-username.example.com"
origin = SiteModel.ORIGIN_XMLRPC
username = null
}

whenever(applicationPasswordsStore.getCredentials(site)).thenReturn(null)

val result = mApplicationPasswordsManager.getApplicationCredentials(site)

Assert.assertTrue(result is ApplicationPasswordCreationResult.Failure)
}

@Test
fun `given a local password exists, when we ask for a password, then return it`() = runTest {
whenever(applicationPasswordsStore.getCredentials(testSite)).thenReturn(testCredentials)
Expand Down
Loading